Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2022-01-05 12:26:28 +0300
committerGhostkeeper <rubend@tutanota.com>2022-01-05 12:26:28 +0300
commitab0c03cf6598b56764169546148a1fa85f61279c (patch)
tree602327e3b748d7d3edfc03673e307e362a74154c
parent58c9522d78fa2279b689b7f38314c5c978f47272 (diff)
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.
-rwxr-xr-xcura/Settings/ExtruderManager.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py
index 81d3f733b4..701d3d987b 100755
--- a/cura/Settings/ExtruderManager.py
+++ b/cura/Settings/ExtruderManager.py
@@ -422,7 +422,10 @@ class ExtruderManager(QObject):
Logger.log("w", "Could not find the variant %s", active_variant_name)
return True
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
if not active_material_node_qualities: