Fix T100731: Keymap Editor context menu crash

Caused by {rB3f3d82cfe9ce}

Since above commit, a `uiRNACollectionSearch` may contain a NULL
`search_prop`, crashing the menu entry for "Jump To Target"
(`ui_jump_to_target_button_poll`).

Now safeguard against this with a NULL check (getting search callbacks
to work for "Jump To Target" can be investigated in master).

Maniphest Tasks: T100731

Differential Revision: https://developer.blender.org/D15832
This commit is contained in:
Philipp Oeser 2022-09-01 10:52:15 +02:00
parent a50ca6a1cd
commit a631dc5575
Notes: blender-bot 2024-04-11 14:26:06 +02:00
Referenced by issue #100731, Regression: Keymap operator right click crash
1 changed files with 7 additions and 2 deletions

View File

@ -1566,8 +1566,13 @@ static bool jump_to_target_button(bContext *C, bool poll)
char str_buf[MAXBONENAME];
char *str_ptr = RNA_property_string_get_alloc(&ptr, prop, str_buf, sizeof(str_buf), NULL);
int found = RNA_property_collection_lookup_string(
&coll_search->search_ptr, coll_search->search_prop, str_ptr, &target_ptr);
int found = 0;
/* Jump to target only works with search properties currently, not search callbacks yet.
* See ui_but_add_search. */
if (coll_search->search_prop != NULL) {
found = RNA_property_collection_lookup_string(
&coll_search->search_ptr, coll_search->search_prop, str_ptr, &target_ptr);
}
if (str_ptr != str_buf) {
MEM_freeN(str_ptr);