From e1fb9121af97f09c2fb4ec9902243d98153d9c4c Mon Sep 17 00:00:00 2001 From: Maxmtg Date: Sat, 29 Jun 2013 20:27:17 +0000 Subject: [PATCH] hotseat: NPE fix at the beginning of 2nd match --- src/main/java/forge/game/GameAction.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/forge/game/GameAction.java b/src/main/java/forge/game/GameAction.java index a31068cd137..39013c6bf8d 100644 --- a/src/main/java/forge/game/GameAction.java +++ b/src/main/java/forge/game/GameAction.java @@ -1487,6 +1487,12 @@ public class GameAction { } } } + + if ( goesFirst == null ) { + // This happens in hotseat matches when 2 equal lobbyplayers play. + // Noone of them has lost, so cannot decide who goes first . + goesFirst = game.getPlayers().get(0); // does not really matter who plays first - it's controlled from the same computer. + } boolean willPlay = goesFirst.getController().getWillPlayOnFirstTurn(isFirstGame); goesFirst = willPlay ? goesFirst : goesFirst.getOpponent();