diff options
author | Ghostkeeper <rubend@tutanota.com> | 2020-08-10 12:16:07 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2020-08-10 12:25:55 +0300 |
commit | fc6ea283528e28da19be1fac384c02a0f588dc30 (patch) | |
tree | 41d27fec330e416f0554d621507ee970a557c317 /plugins/3MFReader | |
parent | ba0efb82bcae2a447c475c4f3ea49d145b767c33 (diff) |
Don't crash if CuraStackBuilder failed to create a stack
If it failed to create a global stack, the extruder_stack_dict variable would not be defined, and Cura crashes. It may fail to create a stack because of an indexerror in a malformed project file.
Fixes Sentry issue CURA-137.
Diffstat (limited to 'plugins/3MFReader')
-rwxr-xr-x | plugins/3MFReader/ThreeMFWorkspaceReader.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 411a78948b..9abab88e6a 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -758,21 +758,22 @@ class ThreeMFWorkspaceReader(WorkspaceReader): Job.yieldThread() QCoreApplication.processEvents() # Ensure that the GUI does not freeze. - # Handle quality changes if any - self._processQualityChanges(global_stack) - - # Prepare the machine - self._applyChangesToMachine(global_stack, extruder_stack_dict) - - Logger.log("d", "Workspace loading is notifying rest of the code of changes...") - # Actually change the active machine. - # - # This is scheduled for later is because it depends on the Variant/Material/Qualitiy Managers to have the latest - # data, but those managers will only update upon a container/container metadata changed signal. Because this - # function is running on the main thread (Qt thread), although those "changed" signals have been emitted, but - # they won't take effect until this function is done. - # To solve this, we schedule _updateActiveMachine() for later so it will have the latest data. - self._updateActiveMachine(global_stack) + if global_stack: + # Handle quality changes if any + self._processQualityChanges(global_stack) + + # Prepare the machine + self._applyChangesToMachine(global_stack, extruder_stack_dict) + + Logger.log("d", "Workspace loading is notifying rest of the code of changes...") + # Actually change the active machine. + # + # This is scheduled for later is because it depends on the Variant/Material/Qualitiy Managers to have the latest + # data, but those managers will only update upon a container/container metadata changed signal. Because this + # function is running on the main thread (Qt thread), although those "changed" signals have been emitted, but + # they won't take effect until this function is done. + # To solve this, we schedule _updateActiveMachine() for later so it will have the latest data. + self._updateActiveMachine(global_stack) # Load all the nodes / mesh data of the workspace nodes = self._3mf_mesh_reader.read(file_name) |