Skip to content

Commit ae6c939

Browse files
committed
fix crash when tournament game fails to start (#794)
1 parent 8bf6bcd commit ae6c939

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

projects/lib/src/tournament.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,18 @@ void Tournament::onGameFinished(ChessGame* game)
730730
{
731731
Q_ASSERT(game != nullptr);
732732

733+
if (!m_gameData.contains(game))
734+
{
735+
// Game failed to start, gameData was removed in onGameStartFailed.
736+
// The game's PGN data is already destroyed, and tournament set to
737+
// stop, so we can simply return here.
738+
return;
739+
}
740+
733741
PgnGame* pgn(game->pgn());
734742

735743
m_finishedGameCount++;
736744

737-
Q_ASSERT(m_gameData.contains(game));
738745
GameData* data = m_gameData.take(game);
739746
int gameNumber = data->number;
740747
Sprt::GameResult sprtResult = Sprt::NoResult;

0 commit comments

Comments
 (0)