- Fixed a possible NPE in destroyNoRegeneration.

This commit is contained in:
Sloth
2013-04-04 11:22:36 +00:00
parent 24e37b13a1
commit 92428d93d1

View File

@@ -1221,6 +1221,7 @@ public class GameAction {
* @return a boolean. * @return a boolean.
*/ */
public final boolean destroyNoRegeneration(final Card c, final SpellAbility sa) { public final boolean destroyNoRegeneration(final Card c, final SpellAbility sa) {
Player activator = null;
if (!c.canBeDestroyed()) if (!c.canBeDestroyed())
return false; return false;
@@ -1266,13 +1267,16 @@ public class GameAction {
return false; return false;
} }
} // totem armor } // totem armor
if (sa != null) {
activator = sa.getActivatingPlayer();
}
// Play the Destroy sound // Play the Destroy sound
game.getEvents().post(new CardDestroyedEvent()); game.getEvents().post(new CardDestroyedEvent());
// Run triggers // Run triggers
final HashMap<String, Object> runParams = new HashMap<String, Object>(); final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Card", c); runParams.put("Card", c);
runParams.put("Causer", sa.getActivatingPlayer()); runParams.put("Causer", activator);
game.getTriggerHandler().runTrigger(TriggerType.Destroyed, runParams, false); game.getTriggerHandler().runTrigger(TriggerType.Destroyed, runParams, false);
return this.sacrificeDestroy(c); return this.sacrificeDestroy(c);