Fix: Interface handlers crash after recent commit

The view item handler would crash when there is no active button.
This commit is contained in:
Hans Goudey 2023-01-03 20:28:56 -05:00
parent 03abc38624
commit 80639a93a8
1 changed files with 5 additions and 3 deletions

View File

@ -9690,12 +9690,14 @@ static int ui_handle_view_item_event(bContext *C,
if (event->type == LEFTMOUSE) {
/* Only bother finding the active view item button if the active button isn't already a view
* item. */
uiBut *view_but = active_but->type == UI_BTYPE_VIEW_ITEM ?
uiBut *view_but = (active_but && active_but->type == UI_BTYPE_VIEW_ITEM) ?
active_but :
ui_view_item_find_mouse_over(region, event->xy);
/* Will free active button if there already is one. */
ui_handle_button_activate(C, region, view_but, BUTTON_ACTIVATE_OVER);
return ui_do_button(C, view_but->block, view_but, event);
if (view_but) {
ui_handle_button_activate(C, region, view_but, BUTTON_ACTIVATE_OVER);
return ui_do_button(C, view_but->block, view_but, event);
}
}
return WM_UI_HANDLER_CONTINUE;