* Genesis Ultimatum - prevented possible exception during card moving (fixes #7220).

This commit is contained in:
LevelX2 2020-12-04 15:40:34 +01:00
parent ed6bd4d7a7
commit c82feb1b9d

View file

@ -1,5 +1,6 @@
package mage.cards.g;
import java.util.Objects;
import mage.MageItem;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -69,7 +70,7 @@ class GenesisUltimatumEffect extends OneShotEffect {
return false;
}
Cards toHand = new CardsImpl(player.getLibrary().getTopCards(game, 5));
// player.lookAtCards("", toHand, game);
player.lookAtCards(source, null, toHand, game);
TargetCard targetCard = new TargetCardInLibrary(0, 5, filter);
player.choose(outcome, toHand, targetCard, game);
Cards toBattlefield = new CardsImpl(targetCard.getTargets());
@ -78,6 +79,7 @@ class GenesisUltimatumEffect extends OneShotEffect {
.stream()
.map(game::getPermanent)
.map(MageItem::getId)
.filter(Objects::nonNull) // to prevent exception https://github.com/magefree/mage/issues/7220
.forEach(toHand::remove);
}
player.moveCards(toHand, Zone.HAND, source, game);