Skip to content

Commit

Permalink
null safety check
Browse files Browse the repository at this point in the history
  • Loading branch information
xenohedron committed Feb 21, 2024
1 parent 35158d7 commit 4d75402
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ private boolean doPiles(Player controller, Ability source, Game game, int toReve
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, toReveal));
controller.revealCards(source, cards, game);

Player separatingPlayer = this.getExecutingPlayer(controller, game, source, playerWhoSeparates, "separate the revealed cards");
Player separatingPlayer = getExecutingPlayer(controller, game, source, playerWhoSeparates, "separate the revealed cards");
if (separatingPlayer == null) {
return false;
}
TargetCard target = new TargetCard(0, cards.size(), Zone.LIBRARY, filter);
List<Card> pile1 = new ArrayList<>();
separatingPlayer.choose(Outcome.Neutral, cards, target, source, game);
Expand All @@ -117,10 +120,12 @@ private boolean doPiles(Player controller, Ability source, Game game, int toReve
.filter(Objects::nonNull)
.forEach(pile1::add);
cards.removeIf(target.getTargets()::contains);
List<Card> pile2 = new ArrayList<>();
pile2.addAll(cards.getCards(game));
List<Card> pile2 = new ArrayList<>(cards.getCards(game));

Player choosingPlayer = this.getExecutingPlayer(controller, game, source, playerWhoChooses, "choose the piles");
Player choosingPlayer = getExecutingPlayer(controller, game, source, playerWhoChooses, "choose the piles");
if (choosingPlayer == null) {
return false;
}
boolean choice = choosingPlayer.choosePile(outcome, "Choose a pile to put into hand.", pile1, pile2, game);

Zone pile1Zone = choice ? Zone.HAND : targetZone;
Expand Down

0 comments on commit 4d75402

Please sign in to comment.