summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 0c99e23650..6e0f61130f 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -702,8 +702,9 @@ ShellOpenFileByName(
}
PathCleanUpDirectories (FileNameCopy);
if (PathRemoveLastItem (FileNameCopy)) {
- ShellCreateDirectory (FileNameCopy, FileHandle);
- ShellCloseFile (FileHandle);
+ if (!EFI_ERROR(ShellCreateDirectory (FileNameCopy, FileHandle))) {
+ ShellCloseFile (FileHandle);
+ }
}
SHELL_FREE_NON_NULL (FileNameCopy);
}