Account for the fact that createMachine can return None

Contributes to issue CURA-5337.
See also #3787.
This commit is contained in:
Ghostkeeper 2018-06-07 11:36:30 +02:00
parent f828c135f8
commit 624bbbeb4a
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
2 changed files with 6 additions and 3 deletions

View file

@ -606,9 +606,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
machine_name = self._container_registry.uniqueName(self._machine_info.name)
global_stack = CuraStackBuilder.createMachine(machine_name, self._machine_info.definition_id)
extruder_stack_dict = global_stack.extruders
if global_stack: #Only switch if creating the machine was successful.
extruder_stack_dict = global_stack.extruders
self._container_registry.addContainer(global_stack)
self._container_registry.addContainer(global_stack)
else:
# Find the machine
global_stack = self._container_registry.findContainerStacks(name = self._machine_info.name, type = "machine")[0]