Skip to content

Commit

Permalink
progress: avoid division by zero
Browse files Browse the repository at this point in the history
This occurs otherwise with `bar.iter([])`.
  • Loading branch information
mathstuf committed Mar 31, 2020
1 parent 1ed4142 commit 0d93258
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions progress/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ def percent(self):

@property
def progress(self):
if self.max == 0:
return 0
return min(1, self.index / self.max)

@property
Expand Down

0 comments on commit 0d93258

Please sign in to comment.