From: Angus Gratton Date: Wed, 5 Dec 2018 07:29:28 +0000 (+1100) Subject: ldgen: Fix crash if --sections argument not supplied X-Git-Tag: v3.3-beta1~14^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f8587360ca9fbd29a585360331cd9c7d4bdd37d;p=esp-idf ldgen: Fix crash if --sections argument not supplied --- diff --git a/tools/ldgen/ldgen.py b/tools/ldgen/ldgen.py index 5078d142fe..33b9cd4f77 100755 --- a/tools/ldgen/ldgen.py +++ b/tools/ldgen/ldgen.py @@ -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: