From 88bf80c42495705a07ec1a491f0bd15e753bfe4c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 7 May 2020 08:53:16 +0200 Subject: [PATCH] Don't provide setVariant with None as variant That is not allowed as per the type. This could happen if the preferred variant of a printer also doesn't exist. Fixes Sentry issue CURA-NP. --- cura/Settings/MachineManager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 0755fdfe4e..2866e3a494 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Ultimaker B.V. +# Copyright (c) 2020 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import time @@ -1424,6 +1424,9 @@ class MachineManager(QObject): machine_definition_id = self._global_container_stack.definition.id machine_node = ContainerTree.getInstance().machines.get(machine_definition_id) variant_node = machine_node.variants.get(variant_name) + if variant_node is None: + Logger.error("There is no variant with the name {variant_name}.") + return self.setVariant(position, variant_node) @pyqtSlot(str, "QVariant")