From 81553096a135df3fd1a4a81ecca5e98585134425 Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Fri, 17 Nov 2017 21:09:49 -0600 Subject: [PATCH] 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. --- tools/build_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build_api.py b/tools/build_api.py index 790b1bcb65..cbe2f8d253 100644 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -575,7 +575,8 @@ def build_project(src_paths, build_path, target, toolchain_name, cur_result["elapsed_time"] = end - start cur_result["output"] = toolchain.get_output() + memap_table cur_result["result"] = "OK" - cur_result["memory_usage"] = memap_instance.mem_report + cur_result["memory_usage"] = (memap_instance.mem_report + if memap_instance is not None else None) cur_result["bin"] = res cur_result["elf"] = splitext(res)[0] + ".elf" cur_result.update(toolchain.report)