Prevent logging from using already-freed game command (#8473)

gc variable is held by reference in the scope above, pointing to the
queue's beginning.
This commit is contained in:
Michał Janiszewski authored and GitHub committed 2018-12-17 23:56:01 +01:00
1 parent 3cc6e1ab15
commit ea61be5ebe
1 file changed
+2 -2
+2 -2
View File
@@ -1885,12 +1885,12 @@ void Network::ProcessGameCommands()
{
// Having old command from a tick where we have not been active yet or malicious server,
// the command is useless so lets not keep it.
game_command_queue.erase(game_command_queue.begin());
log_warning(
"Discarding game command from tick behind current tick, CMD: %08X, CMD Tick: %08X, Current Tick: %08X\n",
gc.esi, gc.tick, gCurrentTicks);
game_command_queue.erase(game_command_queue.begin());
// At this point we should not return, would add the possibility to skip commands this tick.
continue;
}