diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2014-07-03 08:55:29 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2014-07-03 08:58:08 +0400 |
commit | 4af848e557fa8789ac0cc802d6479bd53145e1fd (patch) | |
tree | c39896ad450699b4b027f58c8b267675f9565bd1 /source/gameengine/GameLogic | |
parent | eaf6f9fc5d7a4cdee6fd1ea7dac49ae7b2265ff2 (diff) |
Fix T40923: An error from a python controller on a LibFreed object causes a crash
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PythonController.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 3a9e8ff0bbc..dbcbbea74a6 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -263,7 +263,11 @@ PyAttributeDef SCA_PythonController::Attributes[] = { void SCA_PythonController::ErrorPrint(const char *error_msg) { - printf("%s - object '%s', controller '%s':\n", error_msg, GetParent()->GetName().Ptr(), GetName().Ptr()); + // If GetParent() is NULL, then most likely the object this controller + // was attached to is gone (e.g., removed by LibFree()). + const char *obj_name = (GetParent()) ? GetParent()->GetName().ReadPtr() : "Unavailable"; + const char *ctr_name = (GetParent()) ? GetName().ReadPtr() : "Unavailable"; + printf("%s - object '%s', controller '%s':\n", error_msg, obj_name, ctr_name); PyErr_Print(); /* Added in 2.48a, the last_traceback can reference Objects for example, increasing |