From 0456896d71ccbc6b0ef2b1332a93a23ae6b45178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 24 Jul 2017 12:52:13 +0200 Subject: [PATCH] GCODE Viewer: Fix issue with lookup of layer index 0 We were just testing if z_heights[z] was truthy. If the layer index was set but 0 that wasn't properly detected and let to overwriting our layer information. Instead check explicitly against undefined. Closes #2017 --- src/octoprint/static/gcodeviewer/js/Worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/static/gcodeviewer/js/Worker.js b/src/octoprint/static/gcodeviewer/js/Worker.js index 15658392..f96fa706 100644 --- a/src/octoprint/static/gcodeviewer/js/Worker.js +++ b/src/octoprint/static/gcodeviewer/js/Worker.js @@ -545,7 +545,7 @@ var doParse = function () { } if (typeof(z) !== 'undefined' && z !== prevZ) { - if (z_heights[z]) { + if (z_heights[z] !== undefined) { layer = z_heights[z]; } else { layer = model.length;