Fix client use-after-free reported by mmmds

Fix https://github.com/teeworlds/teeworlds/issues/2645

The `Sv_ReadyToEnter` net message is only valid while we're still
loading stuff, it is used to signal that we can send the `ENTERGAME`
system message. Simply ignoring the server message while we're in the
wrong part of the state machine works.

(cherry picked from commit a97f8a22de)
This commit is contained in:
heinrich5991 2020-06-07 12:26:12 +02:00 committed by ChillerDragon
parent 3d3c190cd4
commit ce2f29b5f1

View file

@ -655,6 +655,12 @@ void CClient::EnterGame()
if(State() == IClient::STATE_DEMOPLAYBACK)
return;
if(State() == IClient::STATE_ONLINE)
{
// Don't reset everything while already in game.
return;
}
// now we will wait for two snapshots
// to finish the connection
SendEnterGame();