diff options
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel1CommandsLib/For.c')
-rw-r--r-- | ShellPkg/Library/UefiShellLevel1CommandsLib/For.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c index b8e4805d92..bc26ed31bc 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c @@ -589,11 +589,16 @@ ShellCommandRunFor ( ASSERT(ArgSet == NULL);
}
- Info = (SHELL_FOR_INFO*)CurrentScriptFile->CurrentCommand->Data;
- if (CurrentScriptFile->CurrentCommand->Reset) {
- Info->CurrentValue = (CHAR16*)Info->Set;
- FirstPass = TRUE;
- CurrentScriptFile->CurrentCommand->Reset = FALSE;
+ if (CurrentScriptFile != NULL && CurrentScriptFile->CurrentCommand != NULL) {
+ Info = (SHELL_FOR_INFO*)CurrentScriptFile->CurrentCommand->Data;
+ if (CurrentScriptFile->CurrentCommand->Reset) {
+ Info->CurrentValue = (CHAR16*)Info->Set;
+ FirstPass = TRUE;
+ CurrentScriptFile->CurrentCommand->Reset = FALSE;
+ }
+ } else {
+ ShellStatus = SHELL_UNSUPPORTED;
+ Info = NULL;
}
if (ShellStatus == SHELL_SUCCESS) {
ASSERT(Info != NULL);
|