From 969b74e1f6e510b61903ab4d3fc8d26c84a598a2 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 24 Oct 2019 10:59:37 +0200 Subject: [PATCH] Prevent crash when sync list somehow contains None I couldn't figure out how it could ever contain None, but we received logs from a user that indicate a crash here because that set contains None and that is not orderable. This is a hotfix to fail more gracefully instead of crashing the entire application. --- cura/PrinterOutput/PrinterOutputDevice.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cura/PrinterOutput/PrinterOutputDevice.py b/cura/PrinterOutput/PrinterOutputDevice.py index ae916e434b..ec682a1739 100644 --- a/cura/PrinterOutput/PrinterOutputDevice.py +++ b/cura/PrinterOutput/PrinterOutputDevice.py @@ -220,6 +220,9 @@ class PrinterOutputDevice(QObject, OutputDevice): if printer.printerConfiguration is not None and printer.printerConfiguration.hasAnyMaterialLoaded(): all_configurations.add(printer.printerConfiguration) all_configurations.update(printer.availableConfigurations) + if None in all_configurations: # Shouldn't happen, but it do. I don't see how it could ever happen. Skip adding that configuration. List could end up empty! + Logger.log("e", "Found a broken configuration in the synced list!") + all_configurations.remove(None) new_configurations = sorted(all_configurations, key = lambda config: config.printerType or "") if new_configurations != self._unique_configurations: self._unique_configurations = new_configurations