From bcb5be77be9422982dd5797d5f1b3078ccdad120 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Wed, 15 Jan 2020 03:50:27 +0400 Subject: [PATCH] Fixed NPE on empty net mana returns (from some effects); --- .../main/java/mage/abilities/effects/common/ManaEffect.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/common/ManaEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ManaEffect.java index 1690fb0b23..01e7308f02 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ManaEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ManaEffect.java @@ -39,7 +39,7 @@ public abstract class ManaEffect extends OneShotEffect { return false; } Mana manaToAdd = produceMana(game, source); - if (manaToAdd.count() > 0) { + if (manaToAdd != null && manaToAdd.count() > 0) { checkToFirePossibleEvents(manaToAdd, game, source); addManaToPool(player, manaToAdd, game, source); } @@ -65,7 +65,7 @@ public abstract class ManaEffect extends OneShotEffect { public List getNetMana(Game game, Ability source) { List netMana = new ArrayList<>(); Mana mana = produceMana(game, source); - if (mana != null) { + if (mana != null && mana.count() > 0) { netMana.add(mana); } return netMana; @@ -80,7 +80,7 @@ public abstract class ManaEffect extends OneShotEffect { * * @param game * @param source - * @return + * @return can return null or empty mana */ public abstract Mana produceMana(Game game, Ability source);