BGE: Fix T45341: Crash when camera is eliminated
authorJorge Bernal <jbernalmartinez@gmail.com>
Mon, 6 Jul 2015 13:40:09 +0000 (15:40 +0200)
committerJorge Bernal <jbernalmartinez@gmail.com>
Mon, 6 Jul 2015 13:40:50 +0000 (15:40 +0200)
A null check is added to avoid crashes when the camera is removed during
the game and no other is available

source/gameengine/Ketsji/KX_Scene.cpp

index 3a596548cfa984f0abfb972f926a71691a1fff64..d33cbb9e2ae163f2d8f267207dfd85721a46f074 100644 (file)
@@ -1756,6 +1756,10 @@ void KX_Scene::RenderFonts()
 void KX_Scene::UpdateObjectLods(void)
 {
        KX_GameObject* gameobj;
+
+       if (!this->m_active_camera)
+               return;
+
        MT_Vector3 cam_pos = this->m_active_camera->NodeGetWorldPosition();
 
        for (int i = 0; i < this->GetObjectList()->GetCount(); i++) {