1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-01-17 03:00:36 +00:00

[RAV] fixed null pointer exception with Bottled Cloister (fixes )

This commit is contained in:
Evan Kranzler 2021-11-21 19:02:23 -05:00
parent f0b08424e6
commit a7e89ec354

View file

@ -12,6 +12,7 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.ExileZone;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
@ -102,10 +103,11 @@ class BottledCloisterReturnEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); 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; 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))); cards.removeIf(uuid -> !player.getId().equals(game.getOwnerId(uuid)));
player.moveCards(cards, Zone.HAND, source, game); player.moveCards(cards, Zone.HAND, source, game);
player.drawCards(1, source, game); player.drawCards(1, source, game);