]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix the bug when no FD section in the FDF file
authorYonghong Zhu <yonghong.zhu@intel.com>
Tue, 26 Jan 2016 08:45:34 +0000 (08:45 +0000)
committeryzhu52 <yzhu52@Edk2>
Tue, 26 Jan 2016 08:45:34 +0000 (08:45 +0000)
Check if the Fdf.CurrentFdName is not None and in Fdf.Profile.FdDict
before using it which fix a crash issue when no FD section in FDF file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19747 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/Python/AutoGen/AutoGen.py

index e9f4888aa19946c5f13beb0b0425e4266bd45a09..dfb5b72b13f4270b2802cf1ed3d5a0751bd9d677 100644 (file)
@@ -317,11 +317,12 @@ class WorkspaceAutoGen(AutoGen):
             GlobalData.gFdfParser = Fdf\r
             GlobalData.gAutoGenPhase = False\r
             PcdSet = Fdf.Profile.PcdDict\r
-            FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]\r
-            for FdRegion in FdDict.RegionList:\r
-                if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):\r
-                    if int(FdRegion.Offset) % 8 != 0:\r
-                        EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base Address %s must be 8-byte aligned.' % (FdRegion.Offset))\r
+            if Fdf.CurrentFdName and Fdf.CurrentFdName in Fdf.Profile.FdDict:\r
+                FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]\r
+                for FdRegion in FdDict.RegionList:\r
+                    if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):\r
+                        if int(FdRegion.Offset) % 8 != 0:\r
+                            EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base Address %s must be 8-byte aligned.' % (FdRegion.Offset))\r
             ModuleList = Fdf.Profile.InfList\r
             self.FdfProfile = Fdf.Profile\r
             for fvname in self.FvTargetList:\r