mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Fixed potentional NPE error
This commit is contained in:
parent
c1dea3456c
commit
878d602b58
1 changed files with 6 additions and 4 deletions
|
@ -42,10 +42,12 @@ public class DragonOnTheBattlefieldWhileSpellWasCastWatcher extends Watcher {
|
|||
// revealed a Dragon card or controlled a Dragon as you cast the spell
|
||||
if (spell != null) {
|
||||
boolean revealedOrOnBattlefield = false;
|
||||
for (Cost cost : spell.getSpellAbility().getCosts()) {
|
||||
if (cost instanceof RevealTargetFromHandCost) {
|
||||
revealedOrOnBattlefield = ((RevealTargetFromHandCost) cost).getNumberRevealedCards() > 0;
|
||||
break;
|
||||
if (spell.getSpellAbility() != null) {
|
||||
for (Cost cost : spell.getSpellAbility().getCosts()) {
|
||||
if (cost instanceof RevealTargetFromHandCost) {
|
||||
revealedOrOnBattlefield = ((RevealTargetFromHandCost) cost).getNumberRevealedCards() > 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!revealedOrOnBattlefield) {
|
||||
|
|
Loading…
Reference in a new issue