Skip to content

Commit

Permalink
Merge pull request #79 from mathstuf/avoid-division-by-zero
Browse files Browse the repository at this point in the history
progress: avoid division by zero
  • Loading branch information
verigak authored Jul 20, 2020
2 parents 03d4adb + 0d93258 commit e5c2368
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 @@ -161,6 +161,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 e5c2368

Please sign in to comment.