Browse Source

Don't crash when switching to printer with fewer extruders

This seems to have happened with an UM2+C.

Fixes Sentry issue CURA-2R5.
Ghostkeeper 3 years ago
parent
commit
58f4d44694
1 changed files with 3 additions and 1 deletions
  1. 3 1
      cura/Settings/MachineManager.py

+ 3 - 1
cura/Settings/MachineManager.py

@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Ultimaker B.V.
+# Copyright (c) 2021 Ultimaker B.V.
 # Cura is released under the terms of the LGPLv3 or higher.
 
 import time
@@ -1398,6 +1398,8 @@ class MachineManager(QObject):
         # previous one).
         self._global_container_stack.setUserChanges(global_user_changes)
         for i, user_changes in enumerate(per_extruder_user_changes):
+            if i >= len(self._global_container_stack.extruderList):  # New printer has fewer extruders.
+                break
             self._global_container_stack.extruderList[i].setUserChanges(per_extruder_user_changes[i])
 
     @pyqtSlot(QObject)