From 64464a38ce5b8a43593c48cb1010d912c5296ef6 Mon Sep 17 00:00:00 2001 From: AndyQ Date: Sun, 17 Feb 2019 11:57:13 +0000 Subject: [PATCH] Fixed error in GCode viewer where multiple filaments available (e.g. using Prusa MMU2), but only using a filament that isn't the first one e.g. filament 4 --- src/octoprint/static/js/app/viewmodels/gcode.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/octoprint/static/js/app/viewmodels/gcode.js b/src/octoprint/static/js/app/viewmodels/gcode.js index f6254fe43..5f9581f33 100644 --- a/src/octoprint/static/js/app/viewmodels/gcode.js +++ b/src/octoprint/static/js/app/viewmodels/gcode.js @@ -568,7 +568,9 @@ $(function() { output.push(gettext("Filament") + ": " + layer.filament[0].toFixed(2) + "mm"); } else { for (var i = 0; i < layer.filament.length; i++) { - output.push(gettext("Filament") + " (" + gettext("Tool") + " " + i + "): " + layer.filament[i].toFixed(2) + "mm"); + if (layer.filament[i] !== undefined) { + output.push(gettext("Filament") + " (" + gettext("Tool") + " " + i + "): " + layer.filament[i].toFixed(2) + "mm"); + } } } }