diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index d65f427cee..6d885f4681 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -1214,10 +1214,13 @@ ShellGetCurrentDir ( return (mEfiShellProtocol->GetCurDir(DeviceName)); } // - // ASSERT that we must have EFI shell + // Check for EFI shell // - ASSERT(mEfiShellEnvironment2 != NULL); - return (mEfiShellEnvironment2->CurDir(DeviceName)); + if (mEfiShellEnvironment2 != NULL) { + return (mEfiShellEnvironment2->CurDir(DeviceName)); + } + + return (NULL); } /** sets (enabled or disabled) the page break mode