mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 22:13:58 -06:00
Return empty node if preferred node couldn't be found
Or any node, really. There must now always be a subnode. Contributes to issue CURA-6600.
This commit is contained in:
parent
d06ce211ff
commit
9dca6c0127
1 changed files with 2 additions and 2 deletions
|
@ -76,11 +76,11 @@ class VariantNode(ContainerNode):
|
|||
# material.
|
||||
# \return The node for the preferred material, or None if there is no
|
||||
# match.
|
||||
def preferredMaterial(self, approximate_diameter) -> Optional[MaterialNode]:
|
||||
def preferredMaterial(self, approximate_diameter) -> MaterialNode:
|
||||
for base_material, material_node in self.materials.items():
|
||||
if self.machine.preferred_material in base_material and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")):
|
||||
return material_node
|
||||
return None
|
||||
return next(iter(self.materials.values()))
|
||||
|
||||
## When a material gets added to the set of profiles, we need to update our
|
||||
# tree here.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue