Fix isDead()/autoforward crash (#9031)
authorParamat <paramat@users.noreply.github.com>
Wed, 9 Oct 2019 18:39:50 +0000 (19:39 +0100)
committerGitHub <noreply@github.com>
Wed, 9 Oct 2019 18:39:50 +0000 (19:39 +0100)
Crash occurred in singleplayer when leaving a world with
autoforward enabled then re-entering a world.

src/client/game.cpp

index 028d2d3bdac9c29e52b4fc667dc56f8030b01b1d..450eb4e32d34c40658bf19d5133124f9b8d92fe3 100644 (file)
@@ -2481,7 +2481,8 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
        }
 
        // autoforward if set: simulate "up" key
-       if (player->getPlayerSettings().continuous_forward && !player->isDead()) {
+       if (player->getPlayerSettings().continuous_forward &&
+                       client->activeObjectsReceived() && !player->isDead()) {
                control.up = true;
                keypress_bits |= 1U << 0;
        }