Fix issue #2279. ok @zeno-
authorLoic Blot <loic.blot@unix-experience.fr>
Wed, 11 Feb 2015 08:57:35 +0000 (09:57 +0100)
committerCraig Robbins <kde.psych@gmail.com>
Sat, 14 Feb 2015 11:02:19 +0000 (21:02 +1000)
src/game.cpp

index ba28aa7897935ee949f67ee560801708f1b88461..a1e2b807a28ce86aecfa1956d0f727491f7864ee 100644 (file)
@@ -3218,10 +3218,13 @@ void Game::updateCamera(VolatileRunFlags *flags, u32 busy_time,
        v3s16 old_camera_offset = camera->getOffset();
 
        if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_CAMERA_MODE])) {
-               camera->toggleCameraMode();
                GenericCAO *playercao = player->getCAO();
 
-               assert(playercao != NULL);
+               // If playercao not loaded, don't change camera
+               if (playercao == NULL)
+                       return;
+
+               camera->toggleCameraMode();
 
                playercao->setVisible(camera->getCameraMode() > CAMERA_MODE_FIRST);
        }