fixed cases that could lead to NPE

This commit is contained in:
North 2013-01-03 15:09:27 +02:00
parent e4349c8b23
commit c083fae37b
9 changed files with 151 additions and 107 deletions

View file

@ -131,8 +131,10 @@ public class DevourEffect extends ReplacementEffectImpl<DevourEffect> {
int devouredCreatures = target.getTargets().size();
game.informPlayers(new StringBuilder(creature.getName()).append(" devours ").append(devouredCreatures).append(" creatures").toString());
for (UUID targetId: target.getTargets()) {
Permanent targetCreature = game.getPermanent(targetId);
cardSubtypes.add((ArrayList<String>) targetCreature.getSubtype());
Permanent targetCreature = game.getPermanent(targetId);
if (targetCreature != null) {
cardSubtypes.add((ArrayList<String>) targetCreature.getSubtype());
}
if (targetCreature == null || !targetCreature.sacrifice(source.getSourceId(), game)) {
return false;
}