Skip to content

Commit 68a06ea

Browse files
committed
SonarQube findings resolution
Accessing sequence elements should not trigger an IndexError. Issue link: https://sonarcloud.io/project/issues?open=AZedPVgw78lmM2RicPGW&id=nrfconnect_sdk-mcuboot Ref: NCSDK-35334 Signed-off-by: Adam Szczygieł <[email protected]>
1 parent 92cc160 commit 68a06ea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/imgtool/boot_record.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def create_sw_component_data(sw_type, sw_version, sw_measurement_description,
4747

4848
# Note: The measurement value must be the last item of the property
4949
# list because later it will be modified by the bootloader.
50-
last_key = list(properties.keys())[-1]
50+
keys = list(properties.keys())
51+
assert len(keys) > 0
52+
last_key = keys[-1]
5153
assert SwComponent.MEASUREMENT_VALUE == last_key, 'Measurement value is not the last item of the property list'
5254
return dumps(properties)

0 commit comments

Comments
 (0)