From 4a2a646943bc1543e6206c325bc67f718b20e7af Mon Sep 17 00:00:00 2001 From: RickyRister <42636155+RickyRister@users.noreply.github.com> Date: Fri, 18 Jul 2025 21:31:50 -0700 Subject: [PATCH] Fix server crash from out-of-bounds index when players is empty (#6048) --- 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)