Skip to content

Commit a015a31

Browse files
committed
Fix zero slice behaviour at index 0
Distinguish between None and 0 when evaluating addresses in __getitem__. Original fix from @mr-eg9 Fixes #52
1 parent d11304a commit a015a31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

intelhex/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ def __getitem__(self, addr):
464464
ih = IntelHex()
465465
if addresses:
466466
addresses.sort()
467-
start = addr.start or addresses[0]
468-
stop = addr.stop or (addresses[-1]+1)
467+
start = addr.start if addr.start is not None else addresses[0]
468+
stop = addr.stop if addr.stop is not None else addresses[-1] + 1
469469
step = addr.step or 1
470470
for i in range_g(start, stop, step):
471471
x = self._buf.get(i)

0 commit comments

Comments
 (0)