Check if 'address' field exists before using it

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2024-05-30 20:52:50 +02:00
parent 69a48abce4
commit 97f7e89e93
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B

View File

@ -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)