BaseTools: Fix one crash bug in the report for Fixed structure Pcd

The case is:
in the DSC file:
SKUID_IDENTIFIER               = ALL

[SkuIds]
  0|DEFAULT
  1|A

[PcdsFixedAtBuild.common.A]
  TokenSpaceGuid.Test401|{0x0F, 0x12}
  TokenSpaceGuid.Test401.TEST401INT8ARRAY[0]|'B'

in the build report, Data = OverrideValues[Keys[0]], but the Keys[0]
is the keyword "DEFAULT", and in this case the "DEFAULT" SKU doesn't
save any value, then it cause the Data is empty, in the next code
when we use the code it cause crash.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
Yonghong Zhu 2018-10-18 22:12:20 +08:00
parent 7cedfa1c81
commit 2c65efac57
1 changed files with 11 additions and 10 deletions

View File

@ -1091,10 +1091,11 @@ class PcdReport(object):
if not Pcd.SkuInfoList:
OverrideValues = Pcd.SkuOverrideValues
if OverrideValues:
Keys = list(OverrideValues.keys())
Data = OverrideValues[Keys[0]]
Struct = list(Data.values())
DscOverride = self.ParseStruct(Struct[0])
for Data in OverrideValues.values():
Struct = list(Data.values())
if Struct:
DscOverride = self.ParseStruct(Struct[0])
break
else:
SkuList = sorted(Pcd.SkuInfoList.keys())
for Sku in SkuList:
@ -1267,12 +1268,12 @@ class PcdReport(object):
if IsStructure:
OverrideValues = Pcd.SkuOverrideValues
if OverrideValues:
Keys = list(OverrideValues.keys())
Data = OverrideValues[Keys[0]]
Struct = list(Data.values())
if Struct:
OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct[0])
self.PrintStructureInfo(File, OverrideFieldStruct)
for Data in OverrideValues.values():
Struct = list(Data.values())
if Struct:
OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct[0])
self.PrintStructureInfo(File, OverrideFieldStruct)
break
self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
else:
FirstPrint = True