Skip to content

Commit 9958531

Browse files
fix memory error when culling active games list (scp-fs2open#7332)
1 parent 150b0c2 commit 9958531

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

code/network/multiui.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@ void multi_join_cull_timeouts()
18031803

18041804
// traverse through the entire list if any items exist
18051805
int i = 0;
1806-
for (auto game = Active_games.begin(); game != Active_games.end(); ++game) {
1806+
for (auto game = Active_games.begin(); game != Active_games.end(); ) {
18071807
if (game->heard_from_timer.isValid() && (ui_timestamp_elapsed(game->heard_from_timer))) {
18081808

18091809
// handle any gui details related to deleting this item
@@ -1815,9 +1815,10 @@ void multi_join_cull_timeouts()
18151815
}
18161816

18171817
// delete the item
1818-
Active_games.erase(game);
1818+
game = Active_games.erase(game);
18191819
} else {
18201820
++i;
1821+
++game;
18211822
}
18221823
}
18231824
}

0 commit comments

Comments
 (0)