From a7a023b5c1c08d3ca5967acaf9bfe62748b93d63 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 19 Jul 2013 19:14:33 +0200 Subject: [PATCH] Fixed NPE if non tournament player submits a deck. --- .../main/java/mage/server/TableController.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Mage.Server/src/main/java/mage/server/TableController.java b/Mage.Server/src/main/java/mage/server/TableController.java index 62cd69820d..11968b9532 100644 --- a/Mage.Server/src/main/java/mage/server/TableController.java +++ b/Mage.Server/src/main/java/mage/server/TableController.java @@ -217,9 +217,18 @@ public class TableController { public synchronized boolean submitDeck(UUID userId, DeckCardLists deckList) throws MageException { UUID playerId = userPlayerMap.get(userId); - TournamentPlayer player = tournament.getPlayer(playerId); - if (player.hasQuit()) { - return true; // so the construct panel closes after submit + if (table.isTournament()) { + TournamentPlayer player = tournament.getPlayer(playerId); + if (player.hasQuit()) { + return true; // so the construct panel closes after submit + } + } else { + if (table.getMatch() != null) { + MatchPlayer mPlayer = table.getMatch().getPlayer(playerId); + if (mPlayer.hasQuit()) { + return true; // so the construct panel closes after submit + } + } } if (table.getState() != TableState.SIDEBOARDING && table.getState() != TableState.CONSTRUCTING) { return false;