Add assertion to make sure the pointer is not NULL.

Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13877 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
niruiyu 2012-10-23 06:42:32 +00:00
parent d5c5ad419e
commit 5077d4e5df
1 changed files with 3 additions and 0 deletions

View File

@ -470,11 +470,13 @@ HotkeyGetOptionNumbers (
NameSize = sizeof (CHAR16);
Name = AllocateZeroPool (NameSize);
ASSERT (Name != NULL);
while (TRUE) {
NewNameSize = NameSize;
Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
if (Status == EFI_BUFFER_TOO_SMALL) {
Name = ReallocatePool (NameSize, NewNameSize, Name);
ASSERT (Name != NULL);
Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
NameSize = NewNameSize;
}
@ -490,6 +492,7 @@ HotkeyGetOptionNumbers (
(*Count + 1) * sizeof (UINT16),
OptionNumbers
);
ASSERT (OptionNumbers != NULL);
for (Index = 0; Index < *Count; Index++) {
if (OptionNumber < OptionNumbers[Index]) {
break;