Browse Source

Do not add an extruder if it has no position set

Otherwise we get very weird values in the extruders dict

Contributes to CURA-3738
Arjen Hiemstra 7 years ago
parent
commit
3b73979a2c
1 changed files with 6 additions and 1 deletions
  1. 6 1
      cura/Settings/GlobalStack.py

+ 6 - 1
cura/Settings/GlobalStack.py

@@ -53,7 +53,12 @@ class GlobalStack(CuraContainerStack):
         if extruder_count and len(self._extruders) + 1 > extruder_count:
             Logger.log("w", "Adding extruder {meta} to {id} but its extruder count is {count}".format(id = self.id, count = extruder_count, meta = str(extruder.getMetaData())))
 
-        self._extruders[extruder.getMetaDataEntry("position", "0")] = extruder
+        position = extruder.getMetaDataEntry("position")
+        if position is None:
+            Logger.log("w", "No position defined for extruder {extruder}, cannot add it to stack {stack}", extruder = extruder.id, stack = self.id)
+            return
+
+        self._extruders[position] = extruder
 
     ##  Overridden from ContainerStack
     #