mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Fixed a possible endless loop in a menu with no selectable items if Setup.MenuScrollWrap is true
This commit is contained in:
14
osdbase.c
14
osdbase.c
@@ -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)
|
||||
|
Reference in New Issue
Block a user