BaseTools: use dictionary.get() when we have value if not found
[mirror_edk2.git] / BaseTools / Source / Python / build / build.py
index 6fb2e0ed3d0966f0a171b19c2ef29970277c3f98..ede963bc231ae7105d865f23b22f2dcfa0595ce5 100644 (file)
@@ -1604,9 +1604,7 @@ class Build():
                         SmmModuleList[Module.MetaFile] = ImageInfo\r
                         SmmSize += ImageInfo.Image.Size\r
                         if Module.ModuleType == 'DXE_SMM_DRIVER':\r
-                            PiSpecVersion = '0x00000000'\r
-                            if 'PI_SPECIFICATION_VERSION' in Module.Module.Specification:\r
-                                PiSpecVersion = Module.Module.Specification['PI_SPECIFICATION_VERSION']\r
+                            PiSpecVersion = Module.Module.Specification.get('PI_SPECIFICATION_VERSION', '0x00000000')\r
                             # for PI specification < PI1.1, DXE_SMM_DRIVER also runs as BOOT time driver.\r
                             if int(PiSpecVersion, 16) < 0x0001000A:\r
                                 BtModuleList[Module.MetaFile] = ImageInfo\r