Fixed possible null pointer exception.

This commit is contained in:
LevelX2 2017-08-30 17:07:57 +02:00
parent 865c0047ae
commit 40689fe1b9

View file

@ -969,6 +969,10 @@ public abstract class PlayerImpl implements Player, Serializable {
ability.setControllerId(getId()); ability.setControllerId(getId());
if (ability.getSpellAbilityType() != SpellAbilityType.BASE) { if (ability.getSpellAbilityType() != SpellAbilityType.BASE) {
ability = chooseSpellAbilityForCast(ability, game, noMana); 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 //20091005 - 601.2a
if (ability.getSourceId() == null) { if (ability.getSourceId() == null) {