Commit bace22175b7ab96d4caacfcb6d1d6b990eca93c1

Authored by Frank Wunderlich
Committed by Tom Rini
1 parent 530b63c228

ensure active menuitem is inside menu

Hi,

setting active menuitem currently can be outside of menu which results in invisible selection

attached Patch fixes this

regards Frank

>From 1d9c4cb8b3e2dd9b0a7a6a2d4a21684d0a099dbf Mon Sep 17 00:00:00 2001
From: Frank Wunderlich <frank-w@public-files.de>
Date: Sun, 2 Dec 2018 11:23:53 +0100
Subject: [PATCH] ensure active menuitem is inside menu

if active menuitem is defined via environment var it can be outside the menu (>=menuitem-count)

this patch resets this definition back to 0

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>

Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff

... ... @@ -351,6 +351,12 @@
351 351 }
352 352  
353 353 menu->count = i;
  354 +
  355 + if ((menu->active >= menu->count)||(menu->active < 0)) { //ensure active menuitem is inside menu
  356 + printf("active menuitem (%d) is outside menu (0..%d)\n",menu->active,menu->count-1);
  357 + menu->active=0;
  358 + }
  359 +
354 360 return menu;
355 361  
356 362 cleanup: