diff options
author | Nino van Hooff <ninovanhooff@gmail.com> | 2019-11-12 17:39:44 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2019-11-13 13:01:03 +0300 |
commit | fe27193c98d3b845e72cd58ed0535ca11d286dfb (patch) | |
tree | b0bfae5f61c21e03506769064b9b5c7b66a4a292 | |
parent | 77c194464e5edd70aedd255163513970dfcf8032 (diff) |
Add dict key check for a crash found in IntentManager
CURA-6976
-rw-r--r-- | cura/Settings/IntentManager.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cura/Settings/IntentManager.py b/cura/Settings/IntentManager.py index c1d59fb84a..879db4f4de 100644 --- a/cura/Settings/IntentManager.py +++ b/cura/Settings/IntentManager.py @@ -36,8 +36,12 @@ class IntentManager(QObject): # \return A list of metadata dictionaries matching the search criteria, or # an empty list if nothing was found. def intentMetadatas(self, definition_id: str, nozzle_name: str, material_base_file: str) -> List[Dict[str, Any]]: - material_node = ContainerTree.getInstance().machines[definition_id].variants[nozzle_name].materials[material_base_file] intent_metadatas = [] + materials = ContainerTree.getInstance().machines[definition_id].variants[nozzle_name].materials + if material_base_file not in materials: + return intent_metadatas + + material_node = materials[material_base_file] for quality_node in material_node.qualities.values(): for intent_node in quality_node.intents.values(): intent_metadatas.append(intent_node.getMetadata()) |