From 5686f6b34f598ccbba43b95ae875b2df1af6ac73 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 6 Apr 2016 15:27:45 +0200 Subject: [PATCH] AuraReplacementEffect - Fixed possible null pointer exception. --- .../abilities/effects/AuraReplacementEffect.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java index 5834d6e243..f4dba03cb2 100644 --- a/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java @@ -91,7 +91,7 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { UUID sourceId = event.getSourceId(); UUID controllerId = event.getPlayerId(); - if(game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null) { + if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null) { card = card.getSecondCardFace(); } @@ -206,10 +206,12 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { if (((ZoneChangeEvent) event).getToZone().equals(Zone.BATTLEFIELD) && !(((ZoneChangeEvent) event).getFromZone().equals(Zone.STACK))) { Card card = game.getCard(event.getTargetId()); - if (card != null && (card.getCardType().contains(CardType.ENCHANTMENT) && card.hasSubtype("Aura") || - (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null && - card.getSecondCardFace().getCardType().contains(CardType.ENCHANTMENT) && - card.getSecondCardFace().hasSubtype("Aura")))) { + if (card != null && (card.getCardType().contains(CardType.ENCHANTMENT) && card.hasSubtype("Aura") + || // in case of transformable enchantments + (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null + && card.getSecondCardFace() != null + && card.getSecondCardFace().getCardType().contains(CardType.ENCHANTMENT) + && card.getSecondCardFace().hasSubtype("Aura")))) { return true; } }