Merge pull request #1837 from spjspj/master

Fix possible NPE for Martyr's Bond
This commit is contained in:
spjspj 2016-04-10 13:01:43 +10:00
commit 635f0244dd

View file

@ -141,9 +141,9 @@ class MartyrsBondEffect extends OneShotEffect {
Card sourceCard = game.getCard(source.getSourceId());
Permanent saccedPermanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && sourceCard != null) {
if (controller != null && sourceCard != null && saccedPermanent != null) {
FilterControlledPermanent filter = new FilterControlledPermanent();
String message = "permanent with a type (";
String message = "permanent with type (";
boolean firstType = true;
ArrayList<CardTypePredicate> cardTypes = new ArrayList<>();
@ -154,7 +154,7 @@ class MartyrsBondEffect extends OneShotEffect {
message += type;
firstType = false;
} else {
message += ", " + type;
message += " or " + type;
}
}
message += ") to sacrifice";
@ -177,9 +177,9 @@ class MartyrsBondEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(permID);
if (permanent != null) {
permanent.sacrifice(source.getSourceId(), game);
return true;
}
}
return true;
}
}
return false;