From 97f7e89e93e14ba4eab20d4d25d45327b3362508 Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Thu, 30 May 2024 20:52:50 +0200 Subject: [PATCH] Check if 'address' field exists before using it Signed-off-by: Juraj Oravec --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index d642df7..24ea1ef 100644 --- a/main.py +++ b/main.py @@ -301,7 +301,9 @@ class Bear(): for index in range(0, entry['number_of_elements']): kid = flat_entry.copy() kid['name'] = '{name}[{index}]'.format(name=flat_entry['name'], index=index) - kid['address'] = hex(int(flat_entry['address'], 16) + entry['size_byte'] * index) + + if ('address' in flat_entry) and ('size_byte' in entry): + kid['address'] = hex(int(flat_entry['address'], 16) + entry['size_byte'] * index) self.pettanko(kid)