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:
authorDiego Prado Gesto <d.pradogesto@ultimaker.com>2018-06-07 11:54:23 +0300
committerDiego Prado Gesto <d.pradogesto@ultimaker.com>2018-06-07 11:54:23 +0300
commit97a1aa1a2b0ba417c8fc1127e5f108aa7eb4a44b (patch)
treeb0d00d7e6b6cd9b2e727d30073d658f12885997d /plugins
parent971d6306bf16596960e521c01a5d5e5aa54fcc91 (diff)
Fix a crash in MaterialManager when the brand of the material is None.
Fix other possible cases when the type or the color are also None.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/XmlMaterialProfile/XmlMaterialProfile.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py
index f0d6915f04..148471fb6d 100644
--- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py
+++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py
@@ -518,9 +518,10 @@ class XmlMaterialProfile(InstanceContainer):
meta_data["name"] = label.text
else:
meta_data["name"] = self._profile_name(material.text, color.text)
- meta_data["brand"] = brand.text
- meta_data["material"] = material.text
- meta_data["color_name"] = color.text
+
+ meta_data["brand"] = brand.text if brand.text is not None else "Unknown Brand"
+ meta_data["material"] = material.text if material.text is not None else "Unknown Type"
+ meta_data["color_name"] = color.text if color.text is not None else "Unknown Color"
continue
# setting_version is derived from the "version" tag in the schema earlier, so don't set it here
@@ -811,9 +812,10 @@ class XmlMaterialProfile(InstanceContainer):
base_metadata["name"] = label.text
else:
base_metadata["name"] = cls._profile_name(material.text, color.text)
- base_metadata["brand"] = brand.text
- base_metadata["material"] = material.text
- base_metadata["color_name"] = color.text
+
+ base_metadata["brand"] = brand.text if brand.text is not None else "Unknown Brand"
+ base_metadata["material"] = material.text if material.text is not None else "Unknown Type"
+ base_metadata["color_name"] = color.text if color.text is not None else "Unknown Color"
continue
#Setting_version is derived from the "version" tag in the schema earlier, so don't set it here.
@@ -976,6 +978,8 @@ class XmlMaterialProfile(InstanceContainer):
@classmethod
def _profile_name(cls, material_name, color_name):
+ if material_name is None:
+ return "Unknown Material"
if color_name != "Generic":
return "%s %s" % (color_name, material_name)
else: