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.
This commit is contained in:
Ghostkeeper 2020-06-25 15:08:08 +02:00
parent 79cc6ec897
commit ffac9adb96
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

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