mirror of
https://github.com/fltk/fltk.git
synced 2025-12-11 13:53:06 +08:00
Fix menu crash dereferencing nullptr (#1335)
This commit is contained in:
@@ -1499,12 +1499,16 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
|
|||||||
pp.menubar_button_helper = nullptr;
|
pp.menubar_button_helper = nullptr;
|
||||||
}
|
}
|
||||||
initial_item = 0; // stop the startup code
|
initial_item = 0; // stop the startup code
|
||||||
|
if (pp.current_menu_ix < 0 || pp.current_menu_ix >= pp.num_menus) {
|
||||||
|
initial_item = 0; // turn off startup code
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pp.menu_window[pp.current_menu_ix]->autoscroll(pp.current_item_ix);
|
pp.menu_window[pp.current_menu_ix]->autoscroll(pp.current_item_ix);
|
||||||
|
|
||||||
STARTUP:
|
STARTUP:
|
||||||
Menu_Window& cw = *pp.menu_window[pp.current_menu_ix];
|
Menu_Window& cw = *pp.menu_window[pp.current_menu_ix];
|
||||||
const Fl_Menu_Item* m = pp.current_item;
|
const Fl_Menu_Item* m = pp.current_item;
|
||||||
if (!m->selectable()) { // pointing at inactive item
|
if (!m || !m->selectable()) { // pointing at inactive item
|
||||||
cw.set_selected(-1);
|
cw.set_selected(-1);
|
||||||
initial_item = 0; // turn off startup code
|
initial_item = 0; // turn off startup code
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user