Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-08-25 13:52:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-08-25 13:52:38 +0400
commitb5d254445ceb889dfb146a134b8ec5b638b4a9d2 (patch)
tree34d87438e729c41345a5cf37c3f7726b1750ed8c /source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
parent1ed408e8c6f835571cbe8176b50500d146a143b2 (diff)
getting the last created object would return an object that had no SG_Node which would crash whenever python tried to get its location.
since the object was removed from the scene anyway, there is no reason to return it.
Diffstat (limited to 'source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
index ca0106d64d9..7e0d0df1ab7 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
@@ -377,7 +377,10 @@ PyObject* KX_SCA_AddObjectActuator::PyGetLastCreatedObject(PyObject* self,
PyObject* kwds)
{
SCA_IObject* result = this->GetLastCreatedObject();
- if (result)
+
+ // if result->GetSGNode() is NULL
+ // it means the object has ended, The BGE python api crashes in many places if the object is returned.
+ if (result && (static_cast<KX_GameObject *>(result))->GetSGNode())
{
result->AddRef();
return result;