From 90fcc93d6e87183c7d2956b4b1e067be25060169 Mon Sep 17 00:00:00 2001 From: simonb Date: Fri, 6 May 2005 15:22:24 +0000 Subject: fix segfault opportunity in menu --- ChangeLog | 2 ++ src/FbTk/Menu.cc | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index a9198ca..7d70594 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.13 *05/05/06: + * Fix potential segfault menu bug, thanks chenfeng (Simon) + Menu.cc * Added more KeyActions to TextBox (thanx to Vadim Control + LeftArrow -> Moves cursor to the left direction, up to next word. Control + RightArrow -> to the right direction. diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index e0e3e7f..e05f531 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc @@ -273,6 +273,9 @@ void Menu::lower() { } void Menu::nextItem() { + if (menuitems.empty()) + return; + int old_which_press = m_which_press; m_active_index = -1; if (validIndex(old_which_press) && @@ -308,6 +311,8 @@ void Menu::nextItem() { } void Menu::prevItem() { + if (menuitems.empty()) + return; int old_which_press = m_which_press; m_active_index = -1; -- cgit v0.11.2