mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 17:18:58 +08:00
Make the deletion of the definitionChanges safer
Just in case findContainerStacks returns an empty list
This commit is contained in:
parent
61def4ba25
commit
d0d7e671ed
@ -738,8 +738,9 @@ class MachineManager(QObject):
|
||||
containers = CuraContainerRegistry.getInstance().findInstanceContainersMetadata(type = "user", machine = machine_id)
|
||||
for container in containers:
|
||||
CuraContainerRegistry.getInstance().removeContainer(container["id"])
|
||||
machine_stack = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", name = machine_id)[0]
|
||||
CuraContainerRegistry.getInstance().removeContainer(machine_stack.definitionChanges.getId())
|
||||
machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", name = machine_id)
|
||||
if machine_stacks:
|
||||
CuraContainerRegistry.getInstance().removeContainer(machine_stacks[0].definitionChanges.getId())
|
||||
CuraContainerRegistry.getInstance().removeContainer(machine_id)
|
||||
|
||||
# If the printer that is being removed is a network printer, the hidden printers have to be also removed
|
||||
|
Loading…
x
Reference in New Issue
Block a user