diff mbox series

[v3,2/2] scripts/runfvp: Fix KeyError exception when there is no FVP_CONSOLE provided

Message ID 20230408081158.7575-2-peron.clem@gmail.com
State New
Headers show
Series [v3,1/2] arm/lib: pass the PATH to fvp runner | expand

Commit Message

Clément Péron April 8, 2023, 8:11 a.m. UTC
We access the dictionnary element that doesn't exist.

Use the get() method instead that will default the element to None if it
doesn't exist.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
---
 scripts/runfvp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/scripts/runfvp b/scripts/runfvp
index 939352b5..e4b00abc 100755
--- a/scripts/runfvp
+++ b/scripts/runfvp
@@ -55,8 +55,8 @@  def start_fvp(args, config, extra_args):
         fvp.start(config, extra_args, args.terminals)
 
         if args.console:
-            expected_terminal = config["consoles"]["default"]
-            if not expected_terminal:
+            expected_terminal = config["consoles"].get("default")
+            if expected_terminal is None:
                 logger.error("--console used but FVP_CONSOLE not set in machine configuration")
                 return 1
             port_stdout, log_stdout = itertools.tee(fvp.stdout, 2)