From a87465186e6ac4622d373112422ccc4bff368b12 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 2 Jan 2018 08:19:31 +0100 Subject: [PATCH] Fix off-by-one bug when importing profiles with extruder stacks Since machine_extruders contains only the extruder stacks (not the global stack) but profile_index counts through all stacks including the global stack, we need to increase the length of machine_extruders by 1 when comparing. I also swapped the comparison around since I think it's more logical this way around. Contributes to issue CURA-4738. --- cura/Settings/CuraContainerRegistry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 089d513071..97391bfa0f 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -224,7 +224,7 @@ class CuraContainerRegistry(ContainerRegistry): # This is assumed to be the global profile profile_id = (global_container_stack.getBottom().getId() + "_" + name_seed).lower().replace(" ", "_") - elif len(machine_extruders) > profile_index: + elif profile_index < len(machine_extruders) + 1: # This is assumed to be an extruder profile extruder_id = Application.getInstance().getMachineManager().getQualityDefinitionId(machine_extruders[profile_index - 1].getBottom()) if not profile.getMetaDataEntry("extruder"):