* Time to Reflect - Fixed possible null pointer exception.

This commit is contained in:
LevelX2 2017-04-18 23:59:06 +02:00
parent 91342cc350
commit d7671bf0b1

View file

@ -45,6 +45,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.Watcher;
@ -73,7 +74,10 @@ public class TimeToReflect extends CardImpl {
BlockedOrWasBlockedByAZombieWatcher watcher = (BlockedOrWasBlockedByAZombieWatcher) game.getState().getWatchers().get("BlockedOrWasBlockedByAZombieWatcher");
if (watcher != null) {
for (MageObjectReference mor : watcher.getBlockedThisTurnCreatures()) {
creaturesThatBlockedOrWereBlockedByAZombie.add(new PermanentIdPredicate(mor.getPermanent(game).getId()));
Permanent permanent = mor.getPermanent(game);
if (permanent != null) {
creaturesThatBlockedOrWereBlockedByAZombie.add(new PermanentIdPredicate(permanent.getId()));
}
}
}
filter.add(Predicates.or(creaturesThatBlockedOrWereBlockedByAZombie));