[Bf-blender-cvs] [80639a93a8e] master: Fix: Interface handlers crash after recent commit

Hans Goudey noreply at git.blender.org
Wed Jan 4 02:29:07 CET 2023


Commit: 80639a93a8efc9cb411672494ada277e91531de6
Author: Hans Goudey
Date:   Tue Jan 3 20:28:56 2023 -0500
Branches: master
https://developer.blender.org/rB80639a93a8efc9cb411672494ada277e91531de6

Fix: Interface handlers crash after recent commit

The view item handler would crash when there is no active button.

===================================================================

M	source/blender/editors/interface/interface_handlers.cc

===================================================================

diff --git a/source/blender/editors/interface/interface_handlers.cc b/source/blender/editors/interface/interface_handlers.cc
index 1055f18d4a0..dfd89dd2b38 100644
--- a/source/blender/editors/interface/interface_handlers.cc
+++ b/source/blender/editors/interface/interface_handlers.cc
@@ -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;



More information about the Bf-blender-cvs mailing list