mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -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
|
return
|
||||||
Logger.log("i", "Attempting to switch the printer type to [%s]", machine_name)
|
Logger.log("i", "Attempting to switch the printer type to [%s]", machine_name)
|
||||||
# Get the definition id corresponding to this 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
|
# Try to find a machine with the same network key
|
||||||
metadata_filter = {"group_id": self._global_container_stack.getMetaDataEntry("group_id")}
|
metadata_filter = {"group_id": self._global_container_stack.getMetaDataEntry("group_id")}
|
||||||
new_machine = self.getMachine(machine_definition_id, metadata_filter = metadata_filter)
|
new_machine = self.getMachine(machine_definition_id, metadata_filter = metadata_filter)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue