From 8a558f2e455751098eb48829c5480b0c9d27e136 Mon Sep 17 00:00:00 2001 From: Michel Selten Date: Wed, 30 Jul 2003 18:47:05 +0000 Subject: [PATCH] * Fixed crash in Object.getTracked() method It tried to create a new Object from the tracked variable, when the variable was NULL. Ouch. --- source/blender/python/api2_2x/Object.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 6312b698eb0..d66a38cab4f 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -764,15 +764,11 @@ static PyObject *Object_getParent (BPy_Object *self) PyObject *attr; if (self->parent) - { - Py_INCREF ((PyObject*)self->parent); - return ((PyObject*)self->parent); - } + return EXPP_incr_ret ((PyObject*) self->parent); if (self->object->parent == NULL) - { - return (EXPP_incr_ret (Py_None)); - } + return EXPP_incr_ret (Py_None); + attr = Object_CreatePyObject (self->object->parent); if (attr) @@ -790,12 +786,11 @@ static PyObject *Object_getTracked (BPy_Object *self) PyObject *attr; if (self->track) - { - Py_INCREF ((PyObject*)self->track); - return ((PyObject*)self->track); - } + return EXPP_incr_ret ((PyObject*)self->track); - /* TODO: what if self->object->track==NULL? Should we return Py_None? */ + if (self->object->track == NULL) + return EXPP_incr_ret (Py_None); + attr = Object_CreatePyObject (self->object->track); if (attr)