From 619fe9a0e78826bd1524b235a910156439bcb6d7 Mon Sep 17 00:00:00 2001 From: C-o-r-E Date: Mon, 17 Mar 2014 23:04:57 -0400 Subject: [PATCH] Fix error where API state is requested and printer is offline --- src/octoprint/printer.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/octoprint/printer.py b/src/octoprint/printer.py index f992b78d..231268bf 100644 --- a/src/octoprint/printer.py +++ b/src/octoprint/printer.py @@ -607,12 +607,13 @@ class Printer(): bedTempOffset = None result = {} - for tool in self._temp.keys(): - result["tool%d" % tool] = { - "actual": self._temp[tool][0], - "target": self._temp[tool][1], - "offset": tempOffset[tool] if tool in tempOffset.keys() and tempOffset[tool] is not None else 0 - } + if self._temp is not None: + for tool in self._temp.keys(): + result["tool%d" % tool] = { + "actual": self._temp[tool][0], + "target": self._temp[tool][1], + "offset": tempOffset[tool] if tool in tempOffset.keys() and tempOffset[tool] is not None else 0 + } if self._bedTemp is not None: result["bed"] = { "actual": self._bedTemp[0],