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:
authorJacques Guignot <guignot@wanadoo.fr>2003-07-22 01:58:13 +0400
committerJacques Guignot <guignot@wanadoo.fr>2003-07-22 01:58:13 +0400
commit9a5cf3cb6679c111794856f038231eab1976826e (patch)
tree30ad57d2d7e01fdc0c44b9644e988d4ed1880301
parentbf23ed161e7a1ce9f5362a826e288d17edbf8d6a (diff)
modified the function getattr, which crashed blender when someone tried to access a NULL field. This function returns now PyNone.
-rw-r--r--source/blender/python/api2_2x/Object.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index 16c192be1a7..b08d35b31a7 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -1324,26 +1324,35 @@ static PyObject* Object_getAttr (BPy_Object *obj, char *name)
return (PyFloat_FromDouble (ika->effg[1]));
case 'Z':
return (PyFloat_FromDouble (ika->effg[2]));
- default:
- /* Do we need to display a sensible error message here? */
- return (NULL);
+ default:
+ /* Do we need to display a sensible error message here? */
+ return (NULL);
}
}
return (NULL);
}
if (StringEqual (name, "Layer"))
- return (PyInt_FromLong(object->lay));
+ return (PyInt_FromLong(object->lay));
if (StringEqual (name, "parent"))
+ if (object->parent)
return (Object_CreatePyObject (object->parent));
+ else
+ {
+ Py_INCREF (Py_None);
+ return (Py_None);
+ }
+
if (StringEqual (name, "track"))
- return (Object_CreatePyObject (object->track));
+ return (Object_CreatePyObject (object->track));
if (StringEqual (name, "data"))
- return (Object_getData (obj));
+ return (Object_getData (obj));
if (StringEqual (name, "ipo"))
{
if (obj->ipo == NULL)
{
- obj->ipo = Ipo_CreatePyObject (object->ipo);
+
+ Py_INCREF (Py_None);
+ return (Py_None);
}
else
{