]> granicus.if.org Git - esp-idf/commitdiff
ldgen: Fix crash if --sections argument not supplied
authorAngus Gratton <angus@espressif.com>
Wed, 5 Dec 2018 07:29:28 +0000 (18:29 +1100)
committerAngus Gratton <gus@projectgus.com>
Wed, 5 Dec 2018 07:29:28 +0000 (18:29 +1100)
tools/ldgen/ldgen.py

index 5078d142fee0a81317ca535e31a9fb5f192880fb..33b9cd4f771e07daeb3c528d4f04ef189e36f519 100755 (executable)
@@ -73,14 +73,17 @@ def main():
     fragment_files = [] if not args.fragments else args.fragments
     config_file = args.config
     output_path = args.output
-    sections_info_files = [] if not args.sections else args.sections
     kconfig_file = args.kconfig
+    sections = args.sections
 
     try:
         sections_infos = SectionsInfo()
 
-        section_info_contents = [s.strip() for s in sections_info_files.read().split("\n")]
-        section_info_contents = [s for s in section_info_contents if s]
+        if sections:
+            section_info_contents = [s.strip() for s in sections.read().split("\n")]
+            section_info_contents = [s for s in section_info_contents if s]
+        else:
+            section_info_contents = []
 
         for sections_info_file in section_info_contents:
             with open(sections_info_file) as sections_info_file_obj: