Check the pointer before use it to avoid potential access violation.

Signed-off-by: ydong10
Reviewed-by: jcarsey

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12533 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2011-10-13 02:37:35 +00:00
parent 90f6df07f8
commit 0c1950ba5e
1 changed files with 4 additions and 9 deletions

View File

@ -2236,14 +2236,9 @@ ShellCommandLineGetFlag (
CHAR16 *TempString;
//
// ASSERT that both CheckPackage and KeyString aren't NULL
// return FALSE for no package or KeyString is NULL
//
ASSERT(KeyString != NULL);
//
// return FALSE for no package
//
if (CheckPackage == NULL) {
if (CheckPackage == NULL || KeyString == NULL) {
return (FALSE);
}
@ -2305,9 +2300,9 @@ ShellCommandLineGetValue (
CHAR16 *TempString;
//
// check for CheckPackage == NULL
// return NULL for no package or KeyString is NULL
//
if (CheckPackage == NULL) {
if (CheckPackage == NULL || KeyString == NULL) {
return (NULL);
}