From 0d93258f5283a45e5a54679339a25e14e68ba4e4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 31 Mar 2020 15:14:55 -0400 Subject: [PATCH] progress: avoid division by zero This occurs otherwise with `bar.iter([])`. --- progress/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/progress/__init__.py b/progress/__init__.py index 596eea7..a213221 100644 --- a/progress/__init__.py +++ b/progress/__init__.py @@ -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