- Attempt to fix NPEs related to SpellAbilityRestrictions queried with no activator set for the spell ability.

This commit is contained in:
Agetian
2014-09-17 15:38:19 +00:00
parent e710743a3b
commit d06edd2ed3
2 changed files with 8 additions and 3 deletions

View File

@@ -123,6 +123,14 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
public boolean isPossible() {
//consider activated abilities possible always and simply disable if not currently playable
//the exception is to consider them not possible if there's a zone or activator restriction that's not met
// FIXME: Something is potentially leading to hard-to-reproducing conditions where this method is getting called
// with no activator set for the SA. Most likely deserves a better fix in the future.
if (this.getActivatingPlayer() == null) {
this.setActivatingPlayer(this.getHostCard().getController());
System.out.println(this.getHostCard().getName() + " Did not have activator set in AbilityActivated.isPossible");
}
return this.getRestrictions().checkZoneRestrictions(this.getHostCard(), this) &&
this.getRestrictions().checkActivatorRestrictions(this.getHostCard(), this);
}

View File

@@ -197,9 +197,6 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
}
Player activator = sa.getActivatingPlayer();
if (activator == null) {
return true;
}
Zone cardZone = activator.getGame().getZoneOf(c);
if (cardZone == null || !cardZone.is(this.getZone())) {