fix for crash when deleting from an id property, with a non-string key.
This commit is contained in:
parent
1457924a21
commit
bbade535fb
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue