From 6c3b0f701a80641108ecfbcf07cd74887ac56961 Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Tue, 15 Nov 2022 12:02:56 +0100 Subject: [PATCH] annotations: avoid generating a KeyError exception Always try to return None when a config is not defined in annotations rather then throwing an exception. Signed-off-by: Andrea Righi --- kconfig/annotations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kconfig/annotations.py b/kconfig/annotations.py index 1b2a791..490a627 100644 --- a/kconfig/annotations.py +++ b/kconfig/annotations.py @@ -216,7 +216,7 @@ class Annotation(Config): return ret elif config is not None and arch is None: # Get a specific config option for all architectures - return self.config[config] + return self.config[config] if config in self.config else None elif config is not None and arch is not None: # Get a specific config option for a specific architecture if config in self.config: -- 2.31.1