Skip to content

Commit abe431f

Browse files
committed
Prevent traceback when memap fails to parse
If map file parsing fails then memap_instance is set to None. To prevent a traceback when parsing fails check if this is None before trying to access any of its fields.
1 parent a519b84 commit abe431f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/build_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ def build_project(src_paths, build_path, target, toolchain_name,
575575
cur_result["elapsed_time"] = end - start
576576
cur_result["output"] = toolchain.get_output() + memap_table
577577
cur_result["result"] = "OK"
578-
cur_result["memory_usage"] = memap_instance.mem_report
578+
cur_result["memory_usage"] = (memap_instance.mem_report
579+
if memap_instance is not None else None)
579580
cur_result["bin"] = res
580581
cur_result["elf"] = splitext(res)[0] + ".elf"
581582
cur_result.update(toolchain.report)

0 commit comments

Comments
 (0)