From 4c3176611a03359633669e74ec3ebebd68eb1d3d Mon Sep 17 00:00:00 2001 From: aurhat Date: Sat, 5 Jul 2014 12:55:15 +0200 Subject: [PATCH] Two fixes concerning items selection in menu The first fixes the last use of menusel, that wasn't checked for range yet. The second one brings menusel back into range, if there is no refresh function. --- source/src/menus.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/src/menus.cpp b/source/src/menus.cpp index f7e4b098..4dde73ee 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -128,7 +128,7 @@ void menuselect(void *menu, int sel) { if(sel!=oldsel) { - m.items[oldsel]->focus(false); + if(m.items.inrange(oldsel)) m.items[oldsel]->focus(false); m.items[sel]->focus(true); audiomgr.playsound(S_MENUSELECT, SP_HIGHEST); } @@ -1210,9 +1210,11 @@ void rendermenumdl() void gmenu::refresh() { - if(!refreshfunc) return; - (*refreshfunc)(this, !inited); - inited = true; + if(refreshfunc) + { + (*refreshfunc)(this, !inited); + inited = true; + } if(menusel>=items.length()) menusel = max(items.length()-1, 0); }