Skip to content

Commit

Permalink
Fix off by one error calculating the maximum next index in binds_get
Browse files Browse the repository at this point in the history
For a device with 16 entries in the binding table and 3 entries per
request, the start_indexes should be 0, 3, 6, 9, 12, 15.

The last next_idx will be 15, which is less than the total 16.
  • Loading branch information
nomis committed Sep 16, 2023
1 parent ab05c8a commit 6614f18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/zha_toolkit/binds.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ async def binds_get(
bindings[next_idx] = bind_info
next_idx += 1

if next_idx + 1 >= total:
if next_idx >= total:
done = True
success = True
else:
Expand Down

0 comments on commit 6614f18

Please sign in to comment.