Fixed potentional NPE error
@@ -42,12 +42,14 @@ public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher {
// revealed a Dragon card or controlled a Dragon as you cast the spell
if (spell != null) {
boolean revealedOrOnBattlefield = false;
+ if (spell.getSpellAbility() != null) {
for (Cost cost : spell.getSpellAbility().getCosts()) {
if (cost instanceof RevealTargetFromHandCost) {
revealedOrOnBattlefield = ((RevealTargetFromHandCost) cost).getNumberRevealedCards() > 0;
break;
}
}
+ }
if (!revealedOrOnBattlefield) {
revealedOrOnBattlefield = game.getBattlefield().countAll(filter, spell.getControllerId(), game) > 0;
}
