mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
Fixed NPE on playerList.getNext usage
This commit is contained in:
parent
f1d2d2fb22
commit
6fa4c0b8f2
7 changed files with 19 additions and 11 deletions
|
|
@ -796,7 +796,9 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
break;
|
||||
}
|
||||
playerByOrder = playerList.getNext(this, true);
|
||||
state.setPlayerByOrderId(playerByOrder.getId());
|
||||
if (playerByOrder != null) {
|
||||
state.setPlayerByOrderId(playerByOrder.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checkIfGameIsOver() && !isSimulation()) {
|
||||
|
|
@ -902,7 +904,10 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
state.getTurn().resumePlay(this, wasPaused);
|
||||
if (!isPaused() && !checkIfGameIsOver()) {
|
||||
endOfTurn();
|
||||
player = playerList.getNext(this, true);
|
||||
Player nextPlayer = playerList.getNext(this, true);
|
||||
if (nextPlayer != null) {
|
||||
player = nextPlayer;
|
||||
}
|
||||
state.setTurnNum(state.getTurnNum() + 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1234,25 +1234,28 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
Player attackingPlayer = game.getPlayer(attackingPlayerId);
|
||||
if (attackingPlayer != null) {
|
||||
PlayerList players;
|
||||
Player opponent;
|
||||
switch (game.getAttackOption()) {
|
||||
case LEFT:
|
||||
players = game.getState().getPlayerList(attackingPlayerId);
|
||||
while (attackingPlayer.isInGame()) {
|
||||
Player opponent = players.getNext(game, false);
|
||||
opponent = players.getNext(game, false);
|
||||
while (opponent != null && attackingPlayer.isInGame()) {
|
||||
if (attackingPlayer.hasOpponent(opponent.getId(), game)) {
|
||||
attackablePlayers.add(opponent.getId());
|
||||
break;
|
||||
}
|
||||
opponent = players.getNext(game, false);
|
||||
}
|
||||
break;
|
||||
case RIGHT:
|
||||
players = game.getState().getPlayerList(attackingPlayerId);
|
||||
opponent = players.getPrevious(game);
|
||||
while (attackingPlayer.isInGame()) {
|
||||
Player opponent = players.getPrevious(game);
|
||||
if (attackingPlayer.hasOpponent(opponent.getId(), game)) {
|
||||
attackablePlayers.add(opponent.getId());
|
||||
break;
|
||||
}
|
||||
opponent = players.getPrevious(game);
|
||||
}
|
||||
break;
|
||||
case MULTIPLE:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue