From 40689fe1b90f7ebff95e89d0d43625a1006a23f1 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 30 Aug 2017 17:07:57 +0200 Subject: [PATCH] Fixed possible null pointer exception. --- Mage/src/main/java/mage/players/PlayerImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index efbbb38964..9fa5e19e8a 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -969,6 +969,10 @@ public abstract class PlayerImpl implements Player, Serializable { ability.setControllerId(getId()); if (ability.getSpellAbilityType() != SpellAbilityType.BASE) { ability = chooseSpellAbilityForCast(ability, game, noMana); + if (ability == null) { + // No ability could be cast (selected), probably because of no valid targets (happens often if a card can be cast by an effect). + return false; + } } //20091005 - 601.2a if (ability.getSourceId() == null) {