/** @file\r
Parser for IFR binary encoding.\r
\r
-Copyright (c) 2007 - 2008, Intel Corporation\r
+Copyright (c) 2007 - 2009, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
CurrentDefault = NULL;\r
CurrentOption = NULL;\r
OptionSuppressExpression = NULL;\r
+ ImageId = NULL;\r
\r
//\r
// Get the number of Statements and Expressions\r
//\r
// Evaluate DisableIf expression\r
//\r
- ASSERT (CurrentExpression != NULL);\r
Status = EvaluateExpression (FormSet, CurrentForm, CurrentExpression);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
+\r
+ ASSERT (CurrentExpression != NULL);\r
if (CurrentExpression->Result.Type != EFI_IFR_TYPE_BOOLEAN) {\r
return EFI_INVALID_PARAMETER;\r
}\r
//\r
case EFI_IFR_SUBTITLE_OP:\r
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);\r
+ ASSERT (CurrentStatement != NULL);\r
+ \r
CurrentStatement->Flags = ((EFI_IFR_SUBTITLE *) OpCodeData)->Flags;\r
\r
if (Scope != 0) {\r
\r
case EFI_IFR_TEXT_OP:\r
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);\r
+ ASSERT (CurrentStatement != NULL);\r
\r
CopyMem (&CurrentStatement->TextTwo, &((EFI_IFR_TEXT *) OpCodeData)->TextTwo, sizeof (EFI_STRING_ID));\r
break;\r
//\r
case EFI_IFR_ACTION_OP:\r
CurrentStatement = CreateQuestion (OpCodeData, FormSet, CurrentForm);\r
+ ASSERT (CurrentStatement != NULL);\r
\r
if (OpCodeLength == sizeof (EFI_IFR_ACTION_1)) {\r
//\r
//\r
// If used for a question, then the question will be read-only\r
//\r
+ //\r
+ // Make sure CurrentStatement is not NULL.\r
+ // If it is NULL, 1) ParseOpCodes functions may parse the IFR wrongly. Or 2) the IFR\r
+ // file is wrongly generated by tools such as VFR Compiler. There may be a bug in VFR Compiler.\r
+ //\r
+ ASSERT (CurrentStatement != NULL);\r
CurrentStatement->ValueExpression = CurrentExpression;\r
}\r
break;\r
break;\r
\r
default:\r
+ //\r
+ // Make sure CurrentStatement is not NULL.\r
+ // If it is NULL, 1) ParseOpCodes functions may parse the IFR wrongly. Or 2) the IFR\r
+ // file is wrongly generated by tools such as VFR Compiler.\r
+ //\r
+ ASSERT (CurrentStatement != NULL);\r
ImageId = &CurrentStatement->ImageId;\r
break;\r
}\r
\r
+ ASSERT (ImageId != NULL);\r
CopyMem (ImageId, &((EFI_IFR_IMAGE *) OpCodeData)->Id, sizeof (EFI_IMAGE_ID));\r
break;\r
\r
// Refresh\r
//\r
case EFI_IFR_REFRESH_OP:\r
+ ASSERT (CurrentStatement != NULL);\r
CurrentStatement->RefreshInterval = ((EFI_IFR_REFRESH *) OpCodeData)->RefreshInterval;\r
break;\r
\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
+\r
+ ASSERT (CurrentExpression != NULL);\r
if (CurrentExpression->Result.Type != EFI_IFR_TYPE_BOOLEAN) {\r
return EFI_INVALID_PARAMETER;\r
}\r