From 769fc8fd3727718721ad82d99d1a5f029d22c7df Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 17 Feb 2020 10:57:24 +0100 Subject: [PATCH] Fix crashing when material could not be found See CURA-3M in sentry. It most commonly happens with the anycubic, since it had some weird stuff with it suddenly supporting materials. This change will make it so that no crash happens. Old profiles will still have an empty material. This isn't really an issue, since the interface will mark this as an error (prompting users to switch). --- cura/Machines/Models/IntentModel.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/Machines/Models/IntentModel.py b/cura/Machines/Models/IntentModel.py index da872f1723..951be7ab2d 100644 --- a/cura/Machines/Models/IntentModel.py +++ b/cura/Machines/Models/IntentModel.py @@ -114,7 +114,10 @@ class IntentModel(ListModel): 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")] + active_material_node = active_variant_node.materials.get(extruder.material.getMetaDataEntry("base_file")) + if active_material_node is None: + Logger.log("w", "Could not find the material %s", extruder.material.getMetaDataEntry("base_file")) + continue nodes.add(active_material_node) return nodes