From f0f378d31e08fb3546fcbc73e94bcbf2ab5439ec Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 21 Nov 2023 15:59:36 +0100 Subject: [PATCH] Fix #115151, step one: Fallback to `ID_OB` in case of defined unknown ID type. This is mainly intended to support forward compatibility with future, unknwon ID types. Actual reported issue will be fixed in next commit. --- source/blender/python/generic/idprop_py_ui_api.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/python/generic/idprop_py_ui_api.cc b/source/blender/python/generic/idprop_py_ui_api.cc index 8f873ef9572..c04fa040c3e 100644 --- a/source/blender/python/generic/idprop_py_ui_api.cc +++ b/source/blender/python/generic/idprop_py_ui_api.cc @@ -644,7 +644,11 @@ static void idprop_ui_data_to_dict_id(IDProperty *property, PyObject *dict) } const char *id_type = nullptr; - RNA_enum_identifier(rna_enum_id_type_items, id_type_value, &id_type); + if (!RNA_enum_identifier(rna_enum_id_type_items, id_type_value, &id_type)) { + /* Same fall-back as above, in case it is an unknown ID type (from a future version of Blender + * e.g.). */ + RNA_enum_identifier(rna_enum_id_type_items, ID_OB, &id_type); + } PyObject *item = PyUnicode_FromString(id_type); PyDict_SetItemString(dict, "id_type", item); Py_DECREF(item);