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.
This commit is contained in:
Ghostkeeper 2018-01-02 08:19:31 +01:00
parent 689a18ee57
commit a87465186e
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A

View file

@ -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"):