Fixed NPE in TurnMods (fixes #296).

This commit is contained in:
LevelX2 2013-07-25 15:52:20 +02:00
parent 1d6ee80e4c
commit 271e4b61ba

View file

@ -107,12 +107,19 @@ public class TurnMods extends ArrayList<TurnMod> {
} }
public boolean skipStep(UUID playerId, PhaseStep step) { public boolean skipStep(UUID playerId, PhaseStep step) {
ListIterator<TurnMod> it = this.listIterator(this.size()); if (step != null) {
while (it.hasPrevious()) { ListIterator<TurnMod> it = this.listIterator(this.size());
TurnMod turnMod = it.previous(); while (it.hasPrevious()) {
if (turnMod.getSkipStep() != null && turnMod.getPlayerId().equals(playerId) && turnMod.getSkipStep() == step) { TurnMod turnMod = it.previous();
it.remove(); if (turnMod.getSkipStep() != null) {
return true; if (turnMod.getPlayerId().equals(playerId)) {
if (turnMod.getSkipStep() == step) {
it.remove();
return true;
}
}
}
} }
} }
return false; return false;