Fix #117679: operator_menu_enum crashes for an unfound property

Caused by d6a6c3e1fc.

Code from d6a6c3e1fc was trying to get enum items for a property even if
the property itself was not found.

Now return early here (same as to how an early return happens if the
operator was not found).

Pull Request: https://projects.blender.org/blender/blender/pulls/117691
This commit is contained in:
Philipp Oeser
2024-02-01 01:50:55 +01:00
committed by Harley Acheson
parent 93562a1cc5
commit 33fc594da1

View File

@@ -3602,6 +3602,9 @@ static int menu_item_enum_opname_menu_active(bContext *C, uiBut *but, MenuItemLe
/* so the context is passed to itemf functions (some need it) */
WM_operator_properties_sanitize(&ptr, false);
PropertyRNA *prop = RNA_struct_find_property(&ptr, lvl->propname);
if (!prop) {
return -1;
}
RNA_property_enum_items_gettexted(C, &ptr, prop, &item_array, &totitem, &free);
int active = RNA_enum_from_name(item_array, but->str.c_str());
if (free) {