handle null response from getPhase()

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
This commit is contained in:
Jamin W. Collins
2018-03-30 08:20:34 -06:00
parent 434573a5f8
commit 35d0e73901

View File

@@ -610,7 +610,14 @@ public final class CMatchUI
public void updatePhase() { public void updatePhase() {
final PlayerView p = getGameView().getPlayerTurn(); final PlayerView p = getGameView().getPlayerTurn();
final PhaseType ph = getGameView().getPhase(); final PhaseType ph = getGameView().getPhase();
final PhaseLabel lbl = p == null ? null : getFieldViewFor(p).getPhaseIndicator().getLabelFor(ph); // this should never happen, but I've seen it periodically... so, need to get to the bottom of it
PhaseLabel lbl = null;
if (ph != null ) {
lbl = p == null ? null : getFieldViewFor(p).getPhaseIndicator().getLabelFor(ph);
} else {
// not sure what debugging information would help here, log for now
System.err.println("getGameView().getPhase() returned 'null'");
}
resetAllPhaseButtons(); resetAllPhaseButtons();
if (lbl != null) { if (lbl != null) {