From 9ea9bd52157d55efc9ecbfb35c4172b4c3300d08 Mon Sep 17 00:00:00 2001 From: Grant Miller Date: Tue, 26 Apr 2022 21:39:16 -0500 Subject: [PATCH] Prevent crash if `xENR` exists but `xRSTR` doesn't --- stm32data/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stm32data/__main__.py b/stm32data/__main__.py index 76f8fa9..9cd4d81 100755 --- a/stm32data/__main__.py +++ b/stm32data/__main__.py @@ -1268,7 +1268,7 @@ def parse_rcc_regs(): 'field': field['name'], } } - if rstr := y[key.replace('ENR', 'RSTR')]: + if rstr := y.get(key.replace('ENR', 'RSTR')): if field := next(filter(lambda f: f['name'] == f'{peri}RST', rstr['fields']), None): res['reset'] = { 'register': reg.replace('ENR', 'RSTR'),