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:
authorKen Hughes <khughes@pacific.edu>2006-12-21 19:05:01 +0300
committerKen Hughes <khughes@pacific.edu>2006-12-21 19:05:01 +0300
commit7679634ff8ec89a7896479c4424a634d1dd3aeb3 (patch)
treeaf5aa520ce40a07355607251f8acdafa836dc9ca /source/blender/python/api2_2x/Scene.c
parentaf60771ecad15c36ac99f7883cf0656b3d74cd4e (diff)
Python API
---------- Bugfix: Scene.objects.new() didn't check string inputs correctly.
Diffstat (limited to 'source/blender/python/api2_2x/Scene.c')
-rw-r--r--source/blender/python/api2_2x/Scene.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c
index 9b3a1fff9e6..4970ca2078d 100644
--- a/source/blender/python/api2_2x/Scene.c
+++ b/source/blender/python/api2_2x/Scene.c
@@ -1323,7 +1323,7 @@ static PyObject *SceneObSeq_new( BPy_SceneObSeq * self, PyObject *args )
if (self->mode != 0)
return EXPP_ReturnPyObjError( PyExc_TypeError,
"Cannot add new to objects.selection or objects.context!" );
-
+
if( !PyArg_ParseTuple( args, "O|s", &py_data, &name ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected an object and optionally a string as arguments" );
@@ -1354,13 +1354,17 @@ static PyObject *SceneObSeq_new( BPy_SceneObSeq * self, PyObject *args )
} else if( Text3d_CheckPyObject( py_data ) ) {
data = ( void * ) Text3d_FromPyObject( py_data );
type = OB_FONT;
- } else if( desc = PyString_FromString( (PyObject *)py_data ) ) {
- if( !strcmp( desc, "Empty" ) )
+ } else if( ( desc = PyString_AsString( (PyObject *)py_data ) ) != NULL ) {
+ if( !strcmp( desc, "Empty" ) ) {
type = OB_EMPTY;
- data = NULL;
- } else
+ data = NULL;
+ } else
+ goto typeError;
+ } else {
+typeError:
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected an object and optionally a string as arguments" );
+ }
if (!name) {
if (type == OB_EMPTY)
@@ -1451,6 +1455,7 @@ static PyObject *SceneObSeq_new( BPy_SceneObSeq * self, PyObject *args )
test_object_materials( (ID *)object->data );
return Object_CreatePyObject( object );
+
}