From f49403ae2c8b04f8ff76e074c780c6867f64f935 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 8 Jul 2016 20:52:27 +0200 Subject: Fix exception when uploading 0-byte file This could be triggered by an empty file (really empty). The assert is supposed to catch progress calls without a proper upload total being set. We can easily use -1 rather than 0 for that. Signed-off-by: Florian Pritz --- fb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fb.py b/fb.py index 44b4461..4f6868a 100755 --- a/fb.py +++ b/fb.py @@ -277,12 +277,12 @@ class ProgressBar: self.progressData["ulGlobalTotal"] = value def reset(self): - self.progressData["ulGlobalTotal"] = 0 + self.progressData["ulGlobalTotal"] = -1 self.progressData["ulGlobal"] = 0 def progress(self, dltotal, dlnow, ultotal, ulnow): data = self.progressData - assert data["ulGlobalTotal"] > 0 + assert data["ulGlobalTotal"] > -1 if not self.display_progress: return -- cgit v1.2.3-24-g4f1b