From 6ce7fed96d9b5a91ca301472f4b0b28b52fd560a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 22 May 2013 18:32:19 +0200 Subject: [PATCH] Removed cause of NPE --- octoprint/printer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/octoprint/printer.py b/octoprint/printer.py index 3f64d56..c7d182e 100644 --- a/octoprint/printer.py +++ b/octoprint/printer.py @@ -410,7 +410,10 @@ class Printer(): if self._sdPrinting: newLine = None (filePos, fileSize) = self._comm.getSdProgress() - newProgress = float(filePos) / float(fileSize) + if fileSize > 0: + newProgress = float(filePos) / float(fileSize) + else: + newProgress = 0.0 else: newLine = self._comm.getPrintPos() newProgress = float(newLine) / float(len(self._gcodeList))