Allow getContainer() to return None

And in the rest of the locations we must then check if it's None and handle that gracefully.
Here we assume that the getContainer message shows a message to the user if necessary. For now we'll just log it.

Contributes to issue CURA-5045.
This commit is contained in:
Ghostkeeper 2018-03-26 15:48:03 +02:00
parent 2a39d81a3c
commit 6d3fed8f52
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
9 changed files with 52 additions and 23 deletions

View file

@ -90,7 +90,7 @@ class QualitySettingsModel(ListModel):
quality_node = quality_group.nodes_for_extruders.get(str(self._selected_position))
settings_keys = quality_group.getAllKeys()
quality_containers = []
if quality_node is not None:
if quality_node is not None and quality_node.getContainer() is not None:
quality_containers.append(quality_node.getContainer())
# Here, if the user has selected a quality changes, then "quality_changes_group" will not be None, and we fetch
@ -100,7 +100,7 @@ class QualitySettingsModel(ListModel):
quality_changes_node = quality_changes_group.node_for_global
else:
quality_changes_node = quality_changes_group.nodes_for_extruders.get(str(self._selected_position))
if quality_changes_node is not None: # it can be None if number of extruders are changed during runtime
if quality_changes_node is not None and quality_changes_node.getContainer() is not None: # it can be None if number of extruders are changed during runtime
try:
quality_containers.insert(0, quality_changes_node.getContainer())
except RuntimeError: