summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c')
-rw-r--r--ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c
index 8213fae7ac..3e5a59c575 100644
--- a/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c
+++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/Goto.c
@@ -79,7 +79,17 @@ ShellCommandRunGoto (
// Check forwards and then backwards for a label...
//
if (!MoveToTag(GetNextNode, L"endfor", L"for", CompareString, ShellCommandGetCurrentScriptFile(), FALSE, FALSE, TRUE)) {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SYNTAX_NO_MATCHING), gShellLevel1HiiHandle, CompareString, L"Goto", ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
+ ShellPrintHiiEx(
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_SYNTAX_NO_MATCHING),
+ gShellLevel1HiiHandle,
+ CompareString,
+ L"Goto",
+ ShellCommandGetCurrentScriptFile()!=NULL
+ &&ShellCommandGetCurrentScriptFile()->CurrentCommand!=NULL
+ ?ShellCommandGetCurrentScriptFile()->CurrentCommand->Line:0);
ShellStatus = SHELL_NOT_FOUND;
}
FreePool(CompareString);