mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Fix crash when printer definition could not be found
This commit is contained in:
parent
caa348265d
commit
cfc2cc3692
1 changed files with 5 additions and 1 deletions
|
@ -1254,7 +1254,11 @@ class MachineManager(QObject):
|
|||
return
|
||||
Logger.log("i", "Attempting to switch the printer type to [%s]", machine_name)
|
||||
# Get the definition id corresponding to this machine name
|
||||
machine_definition_id = CuraContainerRegistry.getInstance().findDefinitionContainers(name = machine_name)[0].getId()
|
||||
definitions = CuraContainerRegistry.getInstance().findDefinitionContainers(name=machine_name)
|
||||
if not definitions:
|
||||
Logger.log("e", "Unable to switch printer type since it could not be found!")
|
||||
return
|
||||
machine_definition_id = definitions[0].getId()
|
||||
# Try to find a machine with the same network key
|
||||
metadata_filter = {"group_id": self._global_container_stack.getMetaDataEntry("group_id")}
|
||||
new_machine = self.getMachine(machine_definition_id, metadata_filter = metadata_filter)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue