mirror of
https://github.com/verigak/progress.git
synced 2025-12-08 19:33:24 +00:00
progress: avoid division by zero
This occurs otherwise with `bar.iter([])`.
This commit is contained in:
@@ -158,6 +158,8 @@ class Progress(Infinite):
|
||||
|
||||
@property
|
||||
def progress(self):
|
||||
if self.max == 0:
|
||||
return 0
|
||||
return min(1, self.index / self.max)
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user