progress: avoid division by zero

This occurs otherwise with `bar.iter([])`.
This commit is contained in:
Ben Boeckel
2020-03-31 15:14:55 -04:00
parent 1ed414290f
commit 0d93258f52

View File

@@ -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