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) {
ListIterator<TurnMod> it = this.listIterator(this.size());
while (it.hasPrevious()) {
TurnMod turnMod = it.previous();
if (turnMod.getSkipStep() != null && turnMod.getPlayerId().equals(playerId) && turnMod.getSkipStep() == step) {
it.remove();
return true;
if (step != null) {
ListIterator<TurnMod> it = this.listIterator(this.size());
while (it.hasPrevious()) {
TurnMod turnMod = it.previous();
if (turnMod.getSkipStep() != null) {
if (turnMod.getPlayerId().equals(playerId)) {
if (turnMod.getSkipStep() == step) {
it.remove();
return true;
}
}
}
}
}
return false;