Fixed some more possible null pointer exceptions.

This commit is contained in:
LevelX2 2016-06-18 14:46:35 +02:00
parent 7e9d285a49
commit e74f5995cb
6 changed files with 20 additions and 11 deletions

View file

@ -218,7 +218,9 @@ class TawnossCoffinReturnEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
ExileZone exileZone = game.getExile().getExileZone(source.getSourceId());
if (exileZone == null) {
return true;
}
FilterCard filter = new FilterCard();
filter.add(new CardTypePredicate(CardType.CREATURE));
//There should be only 1 there, but the for each loop seems the most practical to get to it

View file

@ -244,8 +244,8 @@ class JestersScepterCounterEffect extends OneShotEffect {
String nameOfExiledCardPayment = (String) game.getState().getValue(source.getSourceId() + "_nameOfExiledCardPayment");
String nameOfExiledCardPayment2 = (String) game.getState().getValue(source.getSourceId() + "_nameOfExiledCardPayment2");
if (nameOfExiledCardPayment != null) {
if (nameOfExiledCardPayment.matches(spell.getName())
|| nameOfExiledCardPayment2.matches(spell.getName())) {
if (nameOfExiledCardPayment.equals(spell.getCard().getName())
|| (nameOfExiledCardPayment2 != null) && nameOfExiledCardPayment2.equals(spell.getCard().getName())) {
return game.getStack().counter(targetPointer.getFirst(game, source), source.getSourceId(), game);
}
}

View file

@ -119,7 +119,10 @@ class EpicExperimentEffect extends OneShotEffect {
}
}
// move cards not cast to graveyard
controller.moveCards(game.getExile().getExileZone(source.getSourceId()).getCards(game), Zone.GRAVEYARD, source, game);
ExileZone exileZone = game.getExile().getExileZone(source.getSourceId());
if (exileZone != null) {
controller.moveCards(exileZone.getCards(game), Zone.GRAVEYARD, source, game);
}
return true;
}
return false;

View file

@ -90,7 +90,7 @@ class InfernoTrapCondition implements Condition {
InfernoTrapWatcher watcher = (InfernoTrapWatcher) game.getState().getWatchers().get(InfernoTrapWatcher.class.getName());
if (watcher != null) {
Set<MageObjectReference> damagingCreatures = watcher.getDamagingCreatures(source.getControllerId());
return !damagingCreatures.isEmpty() && damagingCreatures.size() > 1;
return damagingCreatures != null && damagingCreatures.size() > 1;
}
return false;
}