diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-08 12:46:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-08 12:46:43 +0400 |
commit | bbade535fb88d26df57ae644f6ede259bd3f1c45 (patch) | |
tree | b4b9eb880c8da75f9e8478237888485111e3919d /source | |
parent | 1457924a21cb0339b10866c4461f87a6f8c25ff8 (diff) |
fix for crash when deleting from an id property, with a non-string key.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index 88a56fac93b..da136675e1d 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -525,7 +525,17 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val) } if (val == NULL) { /* del idprop[key] */ - IDProperty *pkey = IDP_GetPropertyFromGroup(prop, _PyUnicode_AsString(key)); + IDProperty *pkey; + const char *name = _PyUnicode_AsString(key); + + if (name == NULL) { + PyErr_Format(PyExc_KeyError, + "expected a string, not %.200s", + Py_TYPE(key)->tp_name); + return -1; + } + + pkey = IDP_GetPropertyFromGroup(prop, name); if (pkey) { IDP_FreeFromGroup(prop, pkey); return 0; |