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:
authorWillian Padovani Germano <wpgermano@gmail.com>2003-08-03 00:49:31 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2003-08-03 00:49:31 +0400
commit41211edfeeb3b0f2c597818ceb6b8c1d49ddf2ee (patch)
tree428174633fcd61efef6c529875efe9f3326b803a
parent1a0fc24542d0787acdba69184e5ac2d19aeec1c0 (diff)
Exppython:
Text module: trying to get the filename attribute didn't check for NULL. Reported by Stani Michiels. Fixed now.
-rw-r--r--source/blender/python/api2_2x/Text.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c
index e9343cb2a7b..41fd6c99f60 100644
--- a/source/blender/python/api2_2x/Text.c
+++ b/source/blender/python/api2_2x/Text.c
@@ -248,7 +248,12 @@ static PyObject *Text_getName(BPy_Text *self)
static PyObject *Text_getFilename(BPy_Text *self)
{
- PyObject *attr = PyString_FromString(self->text->name);
+ PyObject *attr;
+ char *name = self->text->name;
+
+ if (name) attr = PyString_FromString(self->text->name);
+ else
+ attr = Py_None;
if (attr) return attr;
@@ -408,7 +413,7 @@ static PyObject *Text_getAttr (BPy_Text *self, char *name)
if (strcmp(name, "name") == 0)
attr = PyString_FromString(self->text->id.name+2);
else if (strcmp(name, "filename") == 0)
- attr = PyString_FromString(self->text->name);
+ return Text_getFilename(self); /* special: can be null */
else if (strcmp(name, "mode") == 0)
attr = PyInt_FromLong(self->text->flags);
else if (strcmp(name, "nlines") == 0)