&gEfiGlobalVariableGuid,\r
&TempOptionSize\r
);\r
- ASSERT (TempOptionPtr != NULL);\r
//\r
- // Compare with current option variable\r
+ // Compare with current option variable if the previous option is set in global variable.\r
//\r
for (Index = 0; Index < TempOptionSize / sizeof (UINT16); Index++) {\r
+ //\r
+ // TempOptionPtr must not be NULL if we have non-zero TempOptionSize.\r
+ //\r
+ ASSERT (TempOptionPtr != NULL);\r
\r
if (*VariableName == 'B') {\r
UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]);\r
\r
if (UpdateDescription) {\r
//\r
- // The number in option#### to be updated\r
+ // The number in option#### to be updated. \r
+ // In this case, we must have non-NULL TempOptionPtr.\r
//\r
+ ASSERT (TempOptionPtr != NULL);\r
RegisterOptionNumber = TempOptionPtr[Index];\r
} else {\r
//\r
}\r
return Status;\r
}\r
-\r
+ \r
+ //\r
+ // TempOptionPtr must not be NULL if TempOptionSize is not zero.\r
+ //\r
+ ASSERT (TempOptionPtr != NULL);\r
//\r
// Append the new option number to the original option order\r
//\r
OrderItemNum = (TempOptionSize / sizeof (UINT16)) + 1 ;\r
OptionOrderPtr = AllocateZeroPool ( OrderItemNum * sizeof (UINT16));\r
ASSERT (OptionOrderPtr!= NULL);\r
- \r
CopyMem (OptionOrderPtr, TempOptionPtr, (OrderItemNum - 1) * sizeof (UINT16));\r
\r
OptionOrderPtr[Index] = RegisterOptionNumber;\r