diff options
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) |