Do not call printer_device.key before checking if it exists

This commit is contained in:
ChrisTerBeke 2018-12-19 12:10:24 +01:00
parent c4a8545c45
commit cf06cb5351

View file

@ -123,10 +123,11 @@ class DiscoverUM3Action(MachineAction):
# stored into the metadata of the currently active machine.
@pyqtSlot(QObject)
def associateActiveMachineWithPrinterDevice(self, printer_device: Optional["PrinterOutputDevice"]) -> None:
Logger.log("d", "Attempting to set the network key of the active machine to %s", printer_device.key)
if not printer_device:
return
Logger.log("d", "Attempting to set the network key of the active machine to %s", printer_device.key)
global_container_stack = CuraApplication.getInstance().getGlobalContainerStack()
if not global_container_stack:
return