Added handling for if there is no global stack

CURA-2475
This commit is contained in:
Jaime van Kessel 2016-10-06 09:35:31 +02:00
parent ec63d6931e
commit f71b23c72a

View file

@ -75,7 +75,11 @@ class DiscoverUM3Action(MachineAction):
@pyqtProperty("QVariantList", notify = printersChanged)
def foundDevices(self):
if self._network_plugin:
global_printer_type = Application.getInstance().getGlobalContainerStack().getBottom().getId()
if Application.getInstance().getGlobalContainerStack():
global_printer_type = Application.getInstance().getGlobalContainerStack().getBottom().getId()
else:
global_printer_type = "unknown"
printers = list(self._network_plugin.getPrinters().values())
# TODO; There are still some testing printers that don't have a correct printer type, so don't filter out unkown ones just yet.
printers = [printer for printer in printers if printer.printerType == global_printer_type or printer.printerType == "unknown"]