Fix server crash from out-of-bounds index when players is empty (#6048)

This commit is contained in:
RickyRister 2025-07-18 21:31:50 -07:00 committed by GitHub
parent ae47ee802b
commit 4a2a646943
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<int> keys = players.keys();
int listPos = -1;
if (activePlayer != -1)