From 7fab301866b63d90ffb72603fdd3aa30a505cdec Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 22 Dec 2023 18:02:23 +0100 Subject: [PATCH] Guard against index out of bound CURA-7647 --- plugins/SimulationView/SimulationPass.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/SimulationView/SimulationPass.py b/plugins/SimulationView/SimulationPass.py index 3294f4b1e6..e97a0cd32c 100644 --- a/plugins/SimulationView/SimulationPass.py +++ b/plugins/SimulationView/SimulationPass.py @@ -160,14 +160,14 @@ class SimulationPass(RenderPass): ratio = self._layer_view.getCurrentPath() - index pos_a = Vector(polygon.data[index + offset][0], polygon.data[index + offset][1], polygon.data[index + offset][2]) - if ratio > 0.0001: + if ratio <= 0.0001 or index + offset == len(polygon.data): + head_position = pos_a + node.getWorldPosition() + else: pos_b = Vector(polygon.data[index + offset + 1][0], polygon.data[index + offset + 1][1], polygon.data[index + offset + 1][2]) vec = pos_a * (1.0 - ratio) + pos_b * ratio head_position = vec + node.getWorldPosition() - else: - head_position = pos_a + node.getWorldPosition() break break if self._layer_view.getMinimumLayer() > layer: