From 60336cbc4b3d13af9acb2746be7573138e4ce96c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 13 Oct 2013 11:00:28 +0200 Subject: [PATCH] * Fixed possible NPE (fixes #358). Added game log info about sacrificed permanents. --- Mage/src/mage/game/permanent/PermanentImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index fccd958b58..1c59aee195 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -805,6 +805,10 @@ public abstract class PermanentImpl> extends CardImpl //20091005 - 701.13 if (!game.replaceEvent(GameEvent.getEvent(EventType.SACRIFICE_PERMANENT, objectId, sourceId, controllerId))) { if (moveToZone(Zone.GRAVEYARD, sourceId, game, true)) { + Player player = game.getPlayer(getControllerId()); + if (player != null) { + game.informPlayers(new StringBuilder(player.getName()).append(" sacrificed ").append(this.getName()).toString()); + } game.fireEvent(GameEvent.getEvent(EventType.SACRIFICED_PERMANENT, objectId, sourceId, controllerId)); return true; } @@ -870,7 +874,7 @@ public abstract class PermanentImpl> extends CardImpl } Permanent attacker = game.getPermanent(attackerId); // controller of attacking permanent must be an opponent - if (!game.getOpponents(this.getControllerId()).contains(attacker.getControllerId())) { + if (game.getOpponents(this.getControllerId()) != null && !game.getOpponents(this.getControllerId()).contains(attacker.getControllerId())) { return false; } //20101001 - 509.1b