Fixed a possible endless loop in a menu with no selectable items if Setup.MenuScrollWrap is true

This commit is contained in:
Klaus Schmidinger
2005-10-09 10:45:48 +02:00
parent 6a8e2a99cb
commit ccaa4e961e
3 changed files with 16 additions and 6 deletions

View File

@@ -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)