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.
This commit is contained in:
Ghostkeeper 2020-05-07 08:53:16 +02:00
parent 2687578a86
commit 88bf80c424
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -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")