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