]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Use a local variable to cache the pointer.
authorJaben Carsey <jaben.carsey@intel.com>
Wed, 11 May 2016 15:09:34 +0000 (08:09 -0700)
committerJaben Carsey <jaben.carsey@intel.com>
Fri, 13 May 2016 15:03:44 +0000 (08:03 -0700)
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>
ShellPkg/Application/Shell/Shell.c

index b06c1efb4245a8ab32289a0cc6c231775a91f520..47b3118ea701cb414af611f9dbcbe420ced5fd1a 100644 (file)
@@ -2499,6 +2499,7 @@ SetupAndRunCommandOrFile(
   SHELL_FILE_HANDLE         OriginalStdOut;\r
   SHELL_FILE_HANDLE         OriginalStdErr;\r
   SYSTEM_TABLE_INFO         OriginalSystemTableInfo;\r
+  CONST SCRIPT_FILE         *ConstScriptFile;\r
 \r
   //\r
   // Update the StdIn, StdOut, and StdErr for redirection to environment variables, files, etc... unicode and ASCII\r
@@ -2518,10 +2519,11 @@ SetupAndRunCommandOrFile(
   // Now print errors\r
   //\r
   if (EFI_ERROR(Status)) {\r
-    if (ShellCommandGetCurrentScriptFile() == NULL || ShellCommandGetCurrentScriptFile()->CurrentCommand == NULL) {\r
+    ConstScriptFile = ShellCommandGetCurrentScriptFile();\r
+    if (ConstScriptFile == NULL || ConstScriptFile->CurrentCommand == NULL) {\r
       ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR), ShellInfoObject.HiiHandle, (VOID*)(Status));\r
     } else {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID*)(Status), ShellCommandGetCurrentScriptFile()->CurrentCommand->Line);\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID*)(Status), ConstScriptFile->CurrentCommand->Line);\r
     }\r
   }\r
 \r