summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 7a97f7cdcc..8d62b0c558 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -147,6 +147,12 @@ BmFindBootOptionInVariable (
if (OptionNumber == LoadOptionNumberUnassigned) {
BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
+ // Only assert if the BootOption is non-zero
+ if ((BootOptions == NULL) && (BootOptionCount > 0)) {
+ ASSERT (BootOptions != NULL);
+ return LoadOptionNumberUnassigned;
+ }
+
Index = EfiBootManagerFindLoadOption (OptionToFind, BootOptions, BootOptionCount);
if (Index != -1) {
OptionNumber = BootOptions[Index].OptionNumber;