From 371585a0ba54d8b9106b1e50c918737635aa42b5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 28 Jan 2019 15:54:34 +0100 Subject: [PATCH] Fix error if layer number ends up out of range It normally doesn't go out of range, but some defensive coding just in case it does. And to fix a typing error of course. --- plugins/GCodeReader/FlavorParser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index baf21d47ce..f8618712a1 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -107,6 +107,8 @@ class FlavorParser: self._layer_data_builder.setLayerHeight(self._layer_number, path[0][2]) self._layer_data_builder.setLayerThickness(self._layer_number, layer_thickness) this_layer = self._layer_data_builder.getLayer(self._layer_number) + if not this_layer: + return False except ValueError: return False count = len(path)