summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel1CommandsLib/If.c')
-rw-r--r--ShellPkg/Library/UefiShellLevel1CommandsLib/If.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c
index b4a6966..f1953a7 100644
--- a/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c
+++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c
@@ -99,7 +99,11 @@ IsValidProfile (
CONST CHAR16 *TempLocation;
ProfilesString = ShellGetEnvironmentVariable (L"profiles");
- ASSERT (ProfilesString != NULL);
+ if (ProfilesString == NULL) {
+ ASSERT (ProfilesString != NULL);
+ return (FALSE);
+ }
+
TempLocation = StrStr (ProfilesString, String);
if ((TempLocation != NULL) && (*(TempLocation-1) == L';') && (*(TempLocation+StrLen (String)) == L';')) {
return (TRUE);
@@ -895,6 +899,10 @@ ShellCommandRunIf (
// Make sure that an End exists.
//
CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
+ if (CurrentScriptFile == NULL) {
+ return (SHELL_INVALID_PARAMETER);
+ }
+
if (!MoveToTag (GetNextNode, L"endif", L"if", NULL, CurrentScriptFile, TRUE, TRUE, FALSE)) {
ShellPrintHiiEx (
-1,
@@ -1076,6 +1084,9 @@ ShellCommandRunElse (
}
CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
+ if (CurrentScriptFile == NULL) {
+ return (SHELL_INVALID_PARAMETER);
+ }
if (!MoveToTag (GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
ShellPrintHiiEx (
@@ -1158,6 +1169,10 @@ ShellCommandRunEndIf (
}
CurrentScriptFile = ShellCommandGetCurrentScriptFile ();
+ if (CurrentScriptFile == NULL) {
+ return (SHELL_INVALID_PARAMETER);
+ }
+
if (!MoveToTag (GetPreviousNode, L"if", L"endif", NULL, CurrentScriptFile, FALSE, TRUE, FALSE)) {
ShellPrintHiiEx (
-1,