From 1ef5d878c6aa9577ec2853988c62e70c18f53483 Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 21 Jan 2019 10:33:42 -0600 Subject: [PATCH] - added some null checks. #5537 --- Mage.Sets/src/mage/cards/r/RegalBehemoth.java | 7 +++++-- .../effects/mana/AddManaOfAnyColorEffect.java | 14 ++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Mage.Sets/src/mage/cards/r/RegalBehemoth.java b/Mage.Sets/src/mage/cards/r/RegalBehemoth.java index 07e8352ad1..fdf945fef1 100644 --- a/Mage.Sets/src/mage/cards/r/RegalBehemoth.java +++ b/Mage.Sets/src/mage/cards/r/RegalBehemoth.java @@ -80,9 +80,12 @@ class RegalBehemothTriggeredManaAbility extends TriggeredManaAbility { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (isControlledBy(game.getMonarchId())) { + if (game.getMonarchId() != null + && isControlledBy(game.getMonarchId())) { Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); - if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (permanent != null + && getControllerId() != null + && filter.match(permanent, getSourceId(), getControllerId(), game)) { ManaEvent mEvent = (ManaEvent) event; for (Effect effect : getEffects()) { effect.setValue("mana", mEvent.getMana()); diff --git a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyColorEffect.java b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyColorEffect.java index dc03549ea0..42f5af2737 100644 --- a/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyColorEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/mana/AddManaOfAnyColorEffect.java @@ -70,12 +70,14 @@ public class AddManaOfAnyColorEffect extends BasicManaEffect { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { String mes = String.format("Select color of %d mana to add it", this.amount); - ChoiceColor choice = new ChoiceColor(true, mes, game.getObject(source.getSourceId())); - if (controller.choose(outcome, choice, game)) { - if (choice.getColor() != null) { - Mana mana = choice.getMana(amount); - mana.setFlag(setFlag); - return mana; + if (mes != null) { + ChoiceColor choice = new ChoiceColor(true, mes, game.getObject(source.getSourceId())); + if (controller.choose(outcome, choice, game)) { + if (choice.getColor() != null) { + Mana mana = choice.getMana(amount); + mana.setFlag(setFlag); + return mana; + } } } }