summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c')
-rw-r--r--MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
index c660c73145..890728aff5 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
@@ -865,29 +865,33 @@ BootFromFile (
EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
CHAR16 *FileName;
+ FileName = NULL;
+
FileName = ExtractFileNameFromDevicePath(FilePath);
- EfiBootManagerInitializeLoadOption (
- &BootOption,
- 0,
- LoadOptionTypeBoot,
- LOAD_OPTION_ACTIVE,
- FileName,
- FilePath,
- NULL,
- 0
- );
- //
- // Since current no boot from removable media directly is allowed */
- //
- gST->ConOut->ClearScreen (gST->ConOut);
+ if (FileName != NULL) {
+ EfiBootManagerInitializeLoadOption (
+ &BootOption,
+ 0,
+ LoadOptionTypeBoot,
+ LOAD_OPTION_ACTIVE,
+ FileName,
+ FilePath,
+ NULL,
+ 0
+ );
+ //
+ // Since current no boot from removable media directly is allowed */
+ //
+ gST->ConOut->ClearScreen (gST->ConOut);
- BmmSetConsoleMode (FALSE);
- EfiBootManagerBoot (&BootOption);
- BmmSetConsoleMode (TRUE);
+ BmmSetConsoleMode (FALSE);
+ EfiBootManagerBoot (&BootOption);
+ BmmSetConsoleMode (TRUE);
- FreePool(FileName);
+ FreePool(FileName);
- EfiBootManagerFreeLoadOption (&BootOption);
+ EfiBootManagerFreeLoadOption (&BootOption);
+ }
return FALSE;
}