From ffac9adb96ef2d46b91ee6715c26f6c8e1d9e58d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 25 Jun 2020 15:08:08 +0200 Subject: [PATCH] Add default for extruder position The position argument metadata always be there. However if it's not (because the file is old, or manually modified, or a version upgrade worked incorrectly, or whatever) then we shouldn't crash. We just don't know how to order it correctly then. This tries to repair it as best it can. --- 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 a0cfd61e49..e045c6084a 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -226,7 +226,7 @@ class CuraContainerRegistry(ContainerRegistry): global_profile = profile else: extruder_profiles.append(profile) - extruder_profiles = sorted(extruder_profiles, key = lambda x: int(x.getMetaDataEntry("position"))) + extruder_profiles = sorted(extruder_profiles, key = lambda x: int(x.getMetaDataEntry("position", default = "0"))) profile_or_list = [global_profile] + extruder_profiles if not global_profile: