From: oliviermartin Date: Thu, 22 Sep 2011 22:51:35 +0000 (+0000) Subject: ArmPlatformPkg/Bds: Fix menu when no boot entry are present for deletion or update X-Git-Tag: edk2-stable201903~14175 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=c93ab96c015f878b9e20e7b524a566f49bab907b ArmPlatformPkg/Bds: Fix menu when no boot entry are present for deletion or update When there are no boot entries to delete, the boot manager was prompting the user to select an entry to delete. This fix prints a message to let the user know that he is trying delete boot entry when there are none. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12405 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index 3796f826f3..94be464f80 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -227,7 +227,7 @@ BootMenuSelectBootOption ( UINTN Index; // Display the list of supported boot devices - BootOptionCount = 1; + BootOptionCount = 0; for (Entry = GetFirstNode (BootOptionsList); !IsNull (BootOptionsList,Entry); Entry = GetNextNode (BootOptionsList, Entry) @@ -239,7 +239,7 @@ BootMenuSelectBootOption ( continue; } - Print (L"[%d] %s\n", BootOptionCount, BdsLoadOption->Description); + Print (L"[%d] %s\n", (BootOptionCount + 1), BdsLoadOption->Description); DEBUG_CODE_BEGIN(); CHAR16* DevicePathTxt; @@ -264,8 +264,16 @@ BootMenuSelectBootOption ( BootOptionCount++; } + // Check if a valid boot option(s) is found if (BootOptionCount == 0) { - Print (L"No supported Boot Entry.\n"); + if (StrCmp (InputStatement, DELETE_BOOT_ENTRY) == 0) { + Print (L"Nothing to remove!\n"); + }else if (StrCmp (InputStatement, UPDATE_BOOT_ENTRY) == 0) { + Print (L"Couldn't find valid boot entries\n"); + } else{ + Print (L"No supported Boot Entry.\n"); + } + return EFI_NOT_FOUND; } @@ -276,8 +284,8 @@ BootMenuSelectBootOption ( Status = GetHIInputInteger (&BootOptionSelected); if (EFI_ERROR(Status)) { return Status; - } else if ((BootOptionSelected == 0) || (BootOptionSelected >= BootOptionCount)) { - Print(L"Invalid input (max %d)\n",BootOptionCount-1); + } else if ((BootOptionSelected == 0) || (BootOptionSelected > BootOptionCount)) { + Print(L"Invalid input (max %d)\n",BootOptionCount); BootOptionSelected = 0; } }