bugfix [#24214] F6 "last operator" panel repeatable segmentation fault
authorCampbell Barton <ideasman42@gmail.com>
Sun, 10 Oct 2010 23:37:25 +0000 (23:37 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 10 Oct 2010 23:37:25 +0000 (23:37 +0000)
source/blender/editors/interface/interface_handlers.c

index 6d8c368db3f0506ab7dbc15c8007988fdba483e0..654a089dafe360b46a199f34edcdec1adb8941c2 100644 (file)
@@ -5526,16 +5526,20 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
                                                                        ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) ||
                                                                        ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP))
                                                                ) {
-                                                                       if(ui_but_first(block)->type & BUT)
+                                                                       if((bt= ui_but_first(block)) && (bt->type & BUT)) {
                                                                                bt= ui_but_last(block);
-                                                                       else
-                                                                               bt= ui_but_first(block);
+                                                                       }
+                                                                       else {
+                                                                               /* keep ui_but_first() */
+                                                                       }
                                                                }
                                                                else {
-                                                                       if(ui_but_first(block)->type & BUT)
-                                                                               bt= ui_but_first(block);
-                                                                       else
+                                                                       if((bt= ui_but_first(block)) && (bt->type & BUT)) {
+                                                                               /* keep ui_but_first() */
+                                                                       }
+                                                                       else {
                                                                                bt= ui_but_last(block);
+                                                                       }
                                                                }
 
                                                                if(bt)