diff options
author | Campbell Barton <campbell@blender.org> | 2022-11-08 09:17:30 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-11-08 09:17:30 +0300 |
commit | 871375f22206e2da4fa21133501f57c09e1f98ff (patch) | |
tree | f053771501ea31bd841b111e5a1c2544476af908 /source/blender/python | |
parent | 8b151982fe6b9e9ed698282d4f1ab625de87c175 (diff) |
PyAPI: add invalid objects check for RNA struct keys()/values()/items()
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index ffcc210301c..3525e2459ef 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3499,6 +3499,8 @@ PyDoc_STRVAR(pyrna_struct_keys_doc, "\n" BPY_DOC_ID_PROP_TYPE_NOTE); static PyObject *pyrna_struct_keys(BPy_StructRNA *self) { + PYRNA_STRUCT_CHECK_OBJ(self); + if (RNA_struct_idprops_check(self->ptr.type) == 0) { PyErr_SetString(PyExc_TypeError, "bpy_struct.keys(): this type doesn't support IDProperties"); return NULL; @@ -3520,6 +3522,8 @@ PyDoc_STRVAR(pyrna_struct_items_doc, "\n" BPY_DOC_ID_PROP_TYPE_NOTE); static PyObject *pyrna_struct_items(BPy_StructRNA *self) { + PYRNA_STRUCT_CHECK_OBJ(self); + if (RNA_struct_idprops_check(self->ptr.type) == 0) { PyErr_SetString(PyExc_TypeError, "bpy_struct.items(): this type doesn't support IDProperties"); return NULL; @@ -3541,6 +3545,8 @@ PyDoc_STRVAR(pyrna_struct_values_doc, "\n" BPY_DOC_ID_PROP_TYPE_NOTE); static PyObject *pyrna_struct_values(BPy_StructRNA *self) { + PYRNA_STRUCT_CHECK_OBJ(self); + if (RNA_struct_idprops_check(self->ptr.type) == 0) { PyErr_SetString(PyExc_TypeError, "bpy_struct.values(): this type doesn't support IDProperties"); |