Browse Source

scripts/runfvp: Fix KeyError exception when there is no FVP_CONSOLE provided

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>
Signed-off-by: Jon Mason <jon.mason@arm.com>
Clément Péron 2 years ago
parent
commit
316e02c0f1
1 changed files with 2 additions and 2 deletions
  1. 2 2
      scripts/runfvp

+ 2 - 2
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)