From bcf180985d8503245822d420b420f826d0b2de72 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 18 Mar 2021 16:17:09 +0100 Subject: [PATCH] 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. --- plugins/USBPrinting/USBPrinterOutputDevice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index 30694b074b..70a1f4333e 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -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)