Fix PyAPI crash assigning/deleting id-properties

Caused by D113.
This commit is contained in:
2017-05-06 23:26:18 +10:00
parent 0eef40ed51
commit 5cdd94a58e

View File

@@ -3271,15 +3271,19 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje
return -1;
}
if (value && BPy_StructRNA_Check(value)) {
BPy_StructRNA *val = (BPy_StructRNA *)value;
if (val && self->ptr.type && val->ptr.type) {
if (!RNA_struct_idprops_datablock_allowed(self->ptr.type) &&
RNA_struct_idprops_contains_datablock(val->ptr.type))
{
PyErr_SetString(PyExc_TypeError, "bpy_struct[key] = val: datablock id properties not supported for this type");
PyErr_SetString(
PyExc_TypeError,
"bpy_struct[key] = val: datablock id properties not supported for this type");
return -1;
}
}
}
return BPy_Wrap_SetMapItem(group, key, value);
}