From cbdd109b43c8386d74a7bb40d892e5c2485f71f9 Mon Sep 17 00:00:00 2001 From: jcarsey Date: Mon, 4 Apr 2011 21:41:24 +0000 Subject: check memory allocations for success. check pointer before access. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11503 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLevel1CommandsLib/For.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ShellPkg/Library/UefiShellLevel1CommandsLib') diff --git a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c index 64110099d3..b8e4805d92 100644 --- a/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c +++ b/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c @@ -565,7 +565,9 @@ ShellCommandRunFor ( Info->RemoveSubstAlias = TRUE; } } - CurrentScriptFile->CurrentCommand->Data = Info; + if (CurrentScriptFile->CurrentCommand != NULL) { + CurrentScriptFile->CurrentCommand->Data = Info; + } } else { ShellPrintHiiEx( -1, -- cgit v1.2.3