Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #58 from smcv/57-stopiteration
Browse files Browse the repository at this point in the history
Filemap: catch StopIteration from next(iterator)

Reviewed-by: dedekind
  • Loading branch information
smcv committed Dec 12, 2018
2 parents 14b411a + 2d3d0ae commit db7087b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bmaptools/Filemap.py
Expand Up @@ -476,7 +476,11 @@ def get_mapped_ranges(self, start, count):
_log.debug("FilemapFiemap: get_mapped_ranges(%d, %d(%d))"
% (start, count, start + count - 1))
iterator = self._do_get_mapped_ranges(start, count)
first_prev, last_prev = next(iterator)

try:
first_prev, last_prev = next(iterator)
except StopIteration:
return

for first, last in iterator:
if last_prev == first - 1:
Expand Down

0 comments on commit db7087b

Please sign in to comment.