summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorJaben Carsey <jaben.carsey@intel.com>2016-05-11 08:09:34 -0700
committerJaben Carsey <jaben.carsey@intel.com>2016-05-13 08:03:44 -0700
commit08222019067e168c7f9b2b378b01eac9705e9187 (patch)
treee407f0c5bdd492b517d835fdb644730914a68d06 /ShellPkg
parentcf1d454983fb4fd3b580a92bd242310467a5eaef (diff)
downloadedk2-08222019067e168c7f9b2b378b01eac9705e9187.tar.gz
edk2-08222019067e168c7f9b2b378b01eac9705e9187.tar.bz2
edk2-08222019067e168c7f9b2b378b01eac9705e9187.zip
ShellPkg: Use a local variable to cache the pointer.
CC: Qiu Shumin <shumin.qiu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Application/Shell/Shell.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
index b06c1efb42..47b3118ea7 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -2499,6 +2499,7 @@ SetupAndRunCommandOrFile(
SHELL_FILE_HANDLE OriginalStdOut;
SHELL_FILE_HANDLE OriginalStdErr;
SYSTEM_TABLE_INFO OriginalSystemTableInfo;
+ CONST SCRIPT_FILE *ConstScriptFile;
//
// Update the StdIn, StdOut, and StdErr for redirection to environment variables, files, etc... unicode and ASCII
@@ -2518,10 +2519,11 @@ SetupAndRunCommandOrFile(
// Now print errors
//
if (EFI_ERROR(Status)) {
- if (ShellCommandGetCurrentScriptFile() == NULL || ShellCommandGetCurrentScriptFile()->CurrentCommand == NULL) {
+ ConstScriptFile = ShellCommandGetCurrentScriptFile();
+ if (ConstScriptFile == NULL || ConstScriptFile->CurrentCommand == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR), ShellInfoObject.HiiHandle, (VOID*)(Status));
} else {
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID*)(Status), ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID*)(Status), ConstScriptFile->CurrentCommand->Line);
}
}