From: Andrea Righi Date: Tue, 15 Nov 2022 11:02:56 +0000 (+0100) Subject: annotations: avoid generating a KeyError exception X-Git-Tag: v0.1~63 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=6c3b0f701a80641108ecfbcf07cd74887ac56961;p=annotations.git 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 --- 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: