Fix crash when adding USB device before global stack is created

Like when you plug in a 3D printer via USB while still in the welcome screen.

Fixes Sentry issue CURA-1ZR.
This commit is contained in:
Ghostkeeper 2021-03-18 16:17:09 +01:00
parent 1f9b4c3964
commit bcf180985d
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -211,6 +211,8 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
def _onGlobalContainerStackChanged(self):
container_stack = CuraApplication.getInstance().getGlobalContainerStack()
if container_stack is None:
return
num_extruders = container_stack.getProperty("machine_extruder_count", "value")
# Ensure that a printer is created.
controller = GenericOutputController(self)