BGE: Fixing a NULL pointer exception caused by calling KX_Scene.active_camera when...
authorMitchell Stokes <mogurijin@gmail.com>
Sun, 5 Aug 2012 07:01:08 +0000 (07:01 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Sun, 5 Aug 2012 07:01:08 +0000 (07:01 +0000)
source/gameengine/Ketsji/KX_Scene.cpp

index e09d5f13bfe5acea57479e890de2ab14f9d7e38d..5d4b9ae40c259f5d6fafb7e126fc99b0a5b8fb67 100644 (file)
@@ -2164,7 +2164,11 @@ PyObject* KX_Scene::pyattr_get_cameras(void *self_v, const KX_PYATTRIBUTE_DEF *a
 PyObject* KX_Scene::pyattr_get_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_Scene* self= static_cast<KX_Scene*>(self_v);
-       return self->GetActiveCamera()->GetProxy();
+       KX_Camera* cam= self->GetActiveCamera();
+       if (cam)
+               return self->GetActiveCamera()->GetProxy();
+       else
+               Py_RETURN_NONE;
 }