From a7e89ec354826bcbe959e7c1b54d6ef7e4538aff Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 21 Nov 2021 19:02:23 -0500 Subject: [PATCH] [RAV] fixed null pointer exception with Bottled Cloister (fixes #8451) --- Mage.Sets/src/mage/cards/b/BottledCloister.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/cards/b/BottledCloister.java b/Mage.Sets/src/mage/cards/b/BottledCloister.java index d64cea6e22..f924fdef06 100644 --- a/Mage.Sets/src/mage/cards/b/BottledCloister.java +++ b/Mage.Sets/src/mage/cards/b/BottledCloister.java @@ -12,6 +12,7 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.TargetController; import mage.constants.Zone; +import mage.game.ExileZone; import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; @@ -102,10 +103,11 @@ class BottledCloisterReturnEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - if (player == null) { + ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source)); + if (player == null || exileZone == null || exileZone.isEmpty()) { return false; } - Cards cards = new CardsImpl(game.getExile().getExileZone(CardUtil.getExileZoneId(game, source)).getCards(game)); + Cards cards = new CardsImpl(exileZone.getCards(game)); cards.removeIf(uuid -> !player.getId().equals(game.getOwnerId(uuid))); player.moveCards(cards, Zone.HAND, source, game); player.drawCards(1, source, game);