Fixed NPE on playersList usage

This commit is contained in:
Oleg Agafonov 2020-08-25 23:41:41 +04:00
parent 6fa4c0b8f2
commit cf5b474c29
2 changed files with 2 additions and 2 deletions

View file

@ -66,7 +66,7 @@ class PainsRewardEffect extends OneShotEffect {
game.informPlayers(winner.getLogName() + " has bet " + highBid + " lifes");
Player currentPlayer = playerList.getNextInRange(controller, game);
while (!Objects.equals(currentPlayer, winner)) {
while (currentPlayer != null && !Objects.equals(currentPlayer, winner)) {
String text = winner.getLogName() + " has bet " + highBid + " life" + (highBid > 1 ? "s" : "") + ". Top the bid?";
if (currentPlayer.chooseUse(Outcome.Detriment, text, source, game)) {
int newBid = currentPlayer.getAmount(highBid + 1, Integer.MAX_VALUE, "Choose amount of life to bid", game);

View file

@ -1250,7 +1250,7 @@ public class Combat implements Serializable, Copyable<Combat> {
case RIGHT:
players = game.getState().getPlayerList(attackingPlayerId);
opponent = players.getPrevious(game);
while (attackingPlayer.isInGame()) {
while (opponent != null && attackingPlayer.isInGame()) {
if (attackingPlayer.hasOpponent(opponent.getId(), game)) {
attackablePlayers.add(opponent.getId());
break;