From 73ca50d958d08c5127fff97f3e75f414ca5cf2c4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 9 Nov 2021 10:17:32 +0100 Subject: [PATCH] Handle exception when adhesion extruder could not be found This should be pretty rare; the crash would only happen due to a race condition cura-8584 --- cura/BuildVolume.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 72e7d539ce..8374bddf74 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -6,6 +6,7 @@ import math from typing import List, Optional, TYPE_CHECKING, Any, Set, cast, Iterable, Dict +from UM.Logger import Logger from UM.Mesh.MeshData import MeshData from UM.Mesh.MeshBuilder import MeshBuilder @@ -1078,7 +1079,11 @@ class BuildVolume(SceneNode): # setting does *not* have a limit_to_extruder setting (which means that we can't ask the global extruder what # the value is. adhesion_extruder = self._global_container_stack.getProperty("adhesion_extruder_nr", "value") - adhesion_stack = self._global_container_stack.extruderList[int(adhesion_extruder)] + try: + adhesion_stack = self._global_container_stack.extruderList[int(adhesion_extruder)] + except IndexError: + Logger.warning(f"Couldn't find extruder with index '{adhesion_extruder}', defaulting to 0 instead.") + adhesion_stack = self._global_container_stack.extruderList[0] skirt_brim_line_width = adhesion_stack.getProperty("skirt_brim_line_width", "value") initial_layer_line_width_factor = adhesion_stack.getProperty("initial_layer_line_width_factor", "value")