From: Tobias Gläßer Date: Sat, 7 Aug 2004 11:34:41 +0000 (+0000) Subject: Empty menus shouldn't lead to crashs anymore. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9ea50023ee514dfd2ba0cdb53cef91d6b842bafc;p=supertux.git Empty menus shouldn't lead to crashs anymore. SVN-Revision: 1719 --- diff --git a/lib/gui/menu.cpp b/lib/gui/menu.cpp index 28e6efff7..d35f6d902 100644 --- a/lib/gui/menu.cpp +++ b/lib/gui/menu.cpp @@ -770,7 +770,7 @@ Menu::event(SDL_Event& event) /* An International Character. */ } - if(item[active_item].kind == MN_CONTROLFIELD_KB) + if(item.size() > 0 && item[active_item].kind == MN_CONTROLFIELD_KB) { if(key == SDLK_ESCAPE) { @@ -798,7 +798,7 @@ Menu::event(SDL_Event& event) menuaction = MENU_ACTION_RIGHT; break; case SDLK_SPACE: - if(item[active_item].kind == MN_TEXTFIELD) + if(item.size() > 0 && item[active_item].kind == MN_TEXTFIELD) { menuaction = MENU_ACTION_INPUT; mn_input_char = ' '; @@ -848,7 +848,7 @@ Menu::event(SDL_Event& event) } break; case SDL_JOYBUTTONDOWN: - if (item[active_item].kind == MN_CONTROLFIELD_JS) + if (item.size() > 0 && item[active_item].kind == MN_CONTROLFIELD_JS) { // FIXME: This next line does nothing useable, right? // *item[active_item].int_p = key;