From 57efca13769a9328c5e2ac31efc66201ef89c540 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 5 Dec 2018 19:31:58 +0100 Subject: [PATCH] Fix a possible division by zero error --- cura/PrinterOutput/PrintJobOutputModel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/PrinterOutput/PrintJobOutputModel.py b/cura/PrinterOutput/PrintJobOutputModel.py index 256c9dffe9..a77ac81909 100644 --- a/cura/PrinterOutput/PrintJobOutputModel.py +++ b/cura/PrinterOutput/PrintJobOutputModel.py @@ -132,9 +132,9 @@ class PrintJobOutputModel(QObject): @pyqtProperty(float, notify = timeElapsedChanged) def progress(self) -> float: - result = self.timeElapsed / self.timeTotal - # Never get a progress past 1.0 - return min(result, 1.0) + time_elapsed = max(float(self.timeElapsed), 1.0) # Prevent a division by zero exception + result = time_elapsed / self.timeTotal + return min(result, 1.0) # Never get a progress past 1.0 @pyqtProperty(str, notify=stateChanged) def state(self) -> str: