diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2005-10-09 10:45:48 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2005-10-09 10:45:48 +0200 |
commit | ccaa4e961ea386929a3ba55739f249c621221629 (patch) | |
tree | dfddfb1c486181088fb2c0e4b2c7854e6615394d /osdbase.c | |
parent | 6a8e2a99cbfb1544e6b79f2e58697a44cfe4ec73 (diff) | |
download | vdr-ccaa4e961ea386929a3ba55739f249c621221629.tar.gz vdr-ccaa4e961ea386929a3ba55739f249c621221629.tar.bz2 |
Fixed a possible endless loop in a menu with no selectable items if Setup.MenuScrollWrap is true
Diffstat (limited to 'osdbase.c')
-rw-r--r-- | osdbase.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.c 1.22 2005/10/02 15:00:40 kls Exp $ + * $Id: osdbase.c 1.23 2005/10/09 10:42:35 kls Exp $ */ #include "osdbase.h" @@ -268,14 +268,16 @@ void cOsdMenu::CursorUp(void) int tmpCurrent = current; int lastOnScreen = first + displayMenuItems - 1; int last = Count() - 1; + if (last < 0) + return; while (--tmpCurrent != current) { if (tmpCurrent < 0) { if (Setup.MenuScrollWrap) - tmpCurrent = last; + tmpCurrent = last + 1; else return; } - if (SelectableItem(tmpCurrent)) + else if (SelectableItem(tmpCurrent)) break; } if (first <= tmpCurrent && tmpCurrent <= lastOnScreen) @@ -298,14 +300,16 @@ void cOsdMenu::CursorDown(void) int tmpCurrent = current; int lastOnScreen = first + displayMenuItems - 1; int last = Count() - 1; + if (last < 0) + return; while (++tmpCurrent != current) { if (tmpCurrent > last) { if (Setup.MenuScrollWrap) - tmpCurrent = 0; + tmpCurrent = -1; else return; } - if (SelectableItem(tmpCurrent)) + else if (SelectableItem(tmpCurrent)) break; } if (first <= tmpCurrent && tmpCurrent <= lastOnScreen) |