diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-03-18 07:50:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-03-18 07:52:36 +0300 |
commit | db710e6c0d8c40a3df75cb14411f4ae51e62dfec (patch) | |
tree | e9253656c68299393f35fb7189ee13f6b2e0fa7c /source/blender | |
parent | d0fcbab15283efa35b30c9950cbdd762c5ae411e (diff) |
Fix crash using removed data as function arguments
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index fadc50e3317..2aab7e070c0 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1830,25 +1830,23 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb RNA_property_pointer_set(ptr, prop, param->ptr); } else { + raise_error = true; + } + } + + if (raise_error) { + if (pyrna_struct_validity_check(param) == -1) { + /* error set */ + } + else { PointerRNA tmp; RNA_pointer_create(NULL, ptr_type, NULL, &tmp); PyErr_Format(PyExc_TypeError, - "%.200s %.200s.%.200s expected a %.200s type. not %.200s", + "%.200s %.200s.%.200s expected a %.200s type, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(tmp.type), RNA_struct_identifier(param->ptr.type)); - Py_XDECREF(value_new); return -1; } - } - - if (raise_error) { - PointerRNA tmp; - RNA_pointer_create(NULL, ptr_type, NULL, &tmp); - PyErr_Format(PyExc_TypeError, - "%.200s %.200s.%.200s expected a %.200s type, not %.200s", - error_prefix, RNA_struct_identifier(ptr->type), - RNA_property_identifier(prop), RNA_struct_identifier(tmp.type), - RNA_struct_identifier(param->ptr.type)); Py_XDECREF(value_new); return -1; } } |