diff options
Diffstat (limited to 'source/blender/python/api2_2x/IDProp.c')
-rw-r--r-- | source/blender/python/api2_2x/IDProp.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/IDProp.c b/source/blender/python/api2_2x/IDProp.c index 06a8d75b549..ff785c4d93d 100644 --- a/source/blender/python/api2_2x/IDProp.c +++ b/source/blender/python/api2_2x/IDProp.c @@ -264,7 +264,11 @@ char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObje Py_XDECREF(vals); } - IDP_AddToGroup(group, prop); + if (!IDP_AddToGroup(group, prop)) { + IDP_FreeProperty(prop); + MEM_freeN(prop); + return "property name already exists in group"; + } return NULL; } @@ -848,7 +852,10 @@ PyObject *BPy_IDGroup_NewProperty(BPy_IDProperty *self, PyObject *args) "invalid id property type"); } - IDP_AddToGroup(self->prop, prop); + if (!IDP_AddToGroup(self->prop, prop)) { + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "property name already exists in group"); + } pyprop = BPy_Wrap_IDProperty(self->id, prop); //Py_XINCREF(pyprop); return pyprop; |