From 85d23c3751ad6bc89748b0b4512c7b1e962eb2a6 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Fri, 18 Jul 2025 20:31:29 -0700 Subject: [PATCH] Fix server crash from out-of-bounds index when players is empty --- common/server_game.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/server_game.cpp b/common/server_game.cpp index 9387ccd37..f27772bbb 100644 --- a/common/server_game.cpp +++ b/common/server_game.cpp @@ -677,6 +677,11 @@ void Server_Game::nextTurn() { QMutexLocker locker(&gameMutex); + if (players.isEmpty()) { + qWarning() << "Server_Game::nextTurn was called while players is empty; gameId = " << gameId; + return; + } + const QList keys = players.keys(); int listPos = -1; if (activePlayer != -1)