mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-11 08:47:50 -06:00
Catch KeyError['empty_material'] when evaluating whether there's any profiles
This is currently only used in the pre-read of workspaces. In some cases, the project file may have a material that is not compatible with its own stack using the current rules in Cura, either because the rules changed or because the project file is wrongly crafted/edited. This causes Cura to say there are no quality profiles if the material profile is not compatible with the printer, preventing a crash due to the KeyError.
This commit is contained in:
parent
58c9522d78
commit
ab0c03cf65
1 changed files with 4 additions and 1 deletions
|
@ -422,7 +422,10 @@ class ExtruderManager(QObject):
|
||||||
Logger.log("w", "Could not find the variant %s", active_variant_name)
|
Logger.log("w", "Could not find the variant %s", active_variant_name)
|
||||||
return True
|
return True
|
||||||
active_variant_node = machine_node.variants[active_variant_name]
|
active_variant_node = machine_node.variants[active_variant_name]
|
||||||
active_material_node = active_variant_node.materials[extruder_stack.material.getMetaDataEntry("base_file")]
|
try:
|
||||||
|
active_material_node = active_variant_node.materials[extruder_stack.material.getMetaDataEntry("base_file")]
|
||||||
|
except KeyError: # The material in this stack is not a supported material (e.g. wrong filament diameter, as loaded from a project file).
|
||||||
|
return False
|
||||||
|
|
||||||
active_material_node_qualities = active_material_node.qualities
|
active_material_node_qualities = active_material_node.qualities
|
||||||
if not active_material_node_qualities:
|
if not active_material_node_qualities:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue