Fix NPE when using Nicol Bolas, God-Pharaoh's +1 when an opponent has no cards in hand.
@@ -98,6 +98,7 @@ class NicolBolasGodPharaohPlusOneEffect extends OneShotEffect {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
int numberOfCardsToExile = Math.min(2, opponent.getHand().size());
+ if(numberOfCardsToExile > 0) {
Target target = new TargetCardInHand(numberOfCardsToExile, new FilterCard());
target.setRequired(true);
if (opponent.chooseTarget(Outcome.Exile, target, source, game)) {
@@ -105,6 +106,11 @@ class NicolBolasGodPharaohPlusOneEffect extends OneShotEffect {
cardsToExile.put(opponentId, cards);
}
}
+ else
+ {
+ cardsToExile.put(opponentId, new CardsImpl());
+ }
+ }
}
// Exile all chosen cards at the same time
Cards cardsOpponentsChoseToExile = new CardsImpl();
