mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Prevent crashes when a variant could not be found
This should not happen, but we've seen some cases where it would cause a crash, usually when a previous upgrade did something a bit weird (in this specific case; a printer with an empty variant, whereas it should have a variant). Since any change that the user will make will ensure that the variant is no longer empty (eg; any selection of a variant will mean it's no longer empty) and that there is no way back, it should be pretty safe to ignore the situation as it will resolve itself eventually CURA-6992
This commit is contained in:
parent
9aeb9912c8
commit
fb4ce43f0c
2 changed files with 9 additions and 1 deletions
|
@ -7,6 +7,7 @@ from PyQt5.QtCore import Qt, QObject, pyqtProperty, pyqtSignal
|
|||
import cura.CuraApplication
|
||||
from UM.Qt.ListModel import ListModel
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
from UM.Logger import Logger
|
||||
from cura.Machines.ContainerTree import ContainerTree
|
||||
from cura.Machines.MaterialNode import MaterialNode
|
||||
from cura.Machines.Models.MachineModelUtils import fetchLayerHeight
|
||||
|
@ -101,6 +102,9 @@ class IntentModel(ListModel):
|
|||
|
||||
for extruder in global_stack.extruderList:
|
||||
active_variant_name = extruder.variant.getMetaDataEntry("name")
|
||||
if active_variant_name not in machine_node.variants:
|
||||
Logger.log("w", "Could not find the variant %s", active_variant_name)
|
||||
continue
|
||||
active_variant_node = machine_node.variants[active_variant_name]
|
||||
active_material_node = active_variant_node.materials[extruder.material.getMetaDataEntry("base_file")]
|
||||
nodes.add(active_material_node)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue