BaseTools: Fix build crash when fdf is empty file
authorYunhua Feng <yunhuax.feng@intel.com>
Wed, 25 Jul 2018 04:21:54 +0000 (12:21 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Mon, 30 Jul 2018 01:29:10 +0000 (09:29 +0800)
Fix build crash when fdf is empty file

Fix https://bugzilla.tianocore.org/show_bug.cgi?id=912

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/GenFds/FdfParser.py

index 4be790a..8de0b48 100644 (file)
@@ -423,6 +423,8 @@ class FdfParser:
 \r
     def __StringToList(self):\r
         self.Profile.FileLinesList = [list(s) for s in self.Profile.FileLinesList]\r
+        if not self.Profile.FileLinesList:\r
+            EdkLogger.error('FdfParser', FILE_READ_FAILURE, 'The file is empty!', File=self.FileName)\r
         self.Profile.FileLinesList[-1].append(' ')\r
 \r
     def __ReplaceFragment(self, StartPos, EndPos, Value = ' '):\r