From 3e3dbcdda89581863f9b243270e0ccad5890824e Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Sun, 30 Jun 2024 22:10:36 +0200 Subject: [PATCH] fixed zero division with async total --- src/editor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/editor.py b/src/editor.py index 009c1b9..1a7e08c 100644 --- a/src/editor.py +++ b/src/editor.py @@ -219,8 +219,9 @@ class Editor: h2 = self.height / 2 x0 = w2 - width / 2 y0 = h2 - height / 2 + loaded_width = 0 if total == 0 else width * count / total pygame.draw.rect(self.win, (160, 160, 160), [x0, y0, width, height]) - pygame.draw.rect(self.win, (90, 250, 90), [x0, y0, width * count / total, height]) + pygame.draw.rect(self.win, (90, 250, 90), [x0, y0, loaded_width, height]) self.win.blit(txt, [w2 - txt.get_width() / 2, y0 - txt.get_height() - 5]) pygame.display.flip()