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:
authorMitchell Stokes <mogurijin@gmail.com>2014-07-03 09:55:39 +0400
committerMitchell Stokes <mogurijin@gmail.com>2014-07-03 09:55:39 +0400
commit04fdd35ba538dda8ec47b7267dee82320fda723f (patch)
treedf6909cccdd2e993327db425b4a42ca5c24a2768 /source/gameengine/GameLogic
parent4af848e557fa8789ac0cc802d6479bd53145e1fd (diff)
Slight cleanup for 4af848e.
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index dbcbbea74a6..8c3ce38276e 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -264,9 +264,16 @@ PyAttributeDef SCA_PythonController::Attributes[] = {
void SCA_PythonController::ErrorPrint(const char *error_msg)
{
// 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";
+ // was attached to is gone (e.g., removed by LibFree()). Also, GetName()
+ // can be a bad pointer if GetParent() is NULL, so better be safe and
+ // flag it as unavailable as well
+ const char *obj_name, *ctr_name;
+ if (GetParent()) {
+ obj_name = GetParent()->GetName().ReadPtr();
+ ctr_name = GetName().ReadPtr();
+ } else {
+ obj_name = ctr_name = "Unavailable";
+ }
printf("%s - object '%s', controller '%s':\n", error_msg, obj_name, ctr_name);
PyErr_Print();