From d5224a1c5cfe19e832d7d5780bb84cc4b3449658 Mon Sep 17 00:00:00 2001 From: Halit Aksoy Date: Fri, 16 Sep 2022 21:41:21 +0300 Subject: [PATCH] fix game draw issue --- src/components/InfoPanel.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/InfoPanel.tsx b/src/components/InfoPanel.tsx index 59545fb..c6071ed 100644 --- a/src/components/InfoPanel.tsx +++ b/src/components/InfoPanel.tsx @@ -33,9 +33,9 @@ function getInfoPanelTextByGameState(params: { const isGameEnded = game?.mancalaGame.state == "ended"; if (isGameEnded) { const wonPlayerID = game.mancalaGame.getWonPlayerId(); - const wonPlayer = wonPlayerID == whitePlayer.id ? whitePlayer : blackPlayer; let whoWon; - if (wonPlayer) { + if (wonPlayerID) { + const wonPlayer = wonPlayerID == whitePlayer.id ? whitePlayer : blackPlayer; whoWon = isSpectator ? `${wonPlayer.name} ${context.texts.Won}` : game.mancalaGame.getWonPlayerId() === currentUser.id ? context.texts.YouWon