MdeModulePkg: Add assertion to make code easier for read.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17483 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ruiyu Ni 2015-05-20 07:41:01 +00:00 committed by niruiyu
parent 9d02f824bb
commit eef538572f
1 changed files with 5 additions and 0 deletions

View File

@ -100,6 +100,8 @@ BmGetFreeOptionNumber (
LoadOptionType == LoadOptionTypeSysPrep);
GetEfiGlobalVariable2 (mBmLoadOptionOrderName[LoadOptionType], (VOID **) &OptionOrder, &OptionOrderSize);
ASSERT ((OptionOrder != NULL && OptionOrderSize != 0) || (OptionOrder == NULL && OptionOrderSize == 0));
BootNext = NULL;
if (LoadOptionType == LoadOptionTypeBoot) {
GetEfiGlobalVariable2 (L"BootNext", (VOID**) &BootNext, NULL);
@ -268,6 +270,7 @@ BmAddOptionNumberToOrderVariable (
// Update the option order variable
//
GetEfiGlobalVariable2 (OptionOrderName, (VOID **) &OptionOrder, &OptionOrderSize);
ASSERT ((OptionOrder != NULL && OptionOrderSize != 0) || (OptionOrder == NULL && OptionOrderSize == 0));
Status = EFI_SUCCESS;
for (Index = 0; Index < OptionOrderSize / sizeof (UINT16); Index++) {
@ -557,6 +560,8 @@ EfiBootManagerDeleteLoadOptionVariable (
// If the associated *Order exists, just remove the reference in *Order.
//
GetEfiGlobalVariable2 (mBmLoadOptionOrderName[OptionType], (VOID **) &OptionOrder, &OptionOrderSize);
ASSERT ((OptionOrder != NULL && OptionOrderSize != 0) || (OptionOrder == NULL && OptionOrderSize == 0));
for (Index = 0; Index < OptionOrderSize / sizeof (UINT16); Index++) {
if (OptionOrder[Index] == OptionNumber) {
OptionOrderSize -= sizeof (UINT16);