From 2e7db9b732cea603f64f8ed791e156f495830d6d Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Wed, 15 Jun 2016 14:38:23 +0200 Subject: [PATCH] Adding check whether getGlobalContainerStack() returns None or not. If we get None here, the firmware-updater will be closed and detailed error returned to the logs with an explanation why. --- plugins/USBPrinting/USBPrinterOutputDeviceManager.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index aa6a731c22..2adacde743 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -128,11 +128,18 @@ class USBPrinterOutputDeviceManager(QObject, SignalEmitter, OutputDevicePlugin, return USBPrinterOutputDeviceManager._instance def _getDefaultFirmwareName(self): + # Check whether getGlobalContainerStack() returns None or not... + global_container_stack = Application.getInstance().getGlobalContainerStack() + if not global_container_stack: + Logger.log("c", "getGlobalContainerStack() returned None") + Logger.log("i", "Closing firmware-updater UI as a consequence") + self._firmware_view.close() + # Detecting id of the current machine - machine_id = Application.getInstance().getGlobalContainerStack().getBottom().id + machine_id = global_container_stack.getBottom().id # Detecting whether it has a heated bed - machine_has_heated_bed = Application.getInstance().getGlobalContainerStack().getProperty("machine_heated_bed", "value") + machine_has_heated_bed = global_container_stack.getProperty("machine_heated_bed", "value") if platform.system() == "Linux": baudrate = 115200