Check if there is a global stack when discard/keep dialog closes

When we close Cura, we now remove the global stack first. If the discard/keep dialog closes as a result of closing Cura, this would crash since there is no global stack any more to discard changes from or keep changes in, and we can't access the extruder stacks either.
So if there's no global stack, just skip this. It'll be as if you selected 'keep'.

Fixes Sentry issue CURA-2ET.
This commit is contained in:
Ghostkeeper 2021-06-17 13:44:02 +02:00
parent 788efcc83e
commit fcd585963f
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -708,6 +708,8 @@ class CuraApplication(QtApplication):
@pyqtSlot(str) @pyqtSlot(str)
def discardOrKeepProfileChangesClosed(self, option: str) -> None: def discardOrKeepProfileChangesClosed(self, option: str) -> None:
global_stack = self.getGlobalContainerStack() global_stack = self.getGlobalContainerStack()
if global_stack is None:
return
if option == "discard": if option == "discard":
for extruder in global_stack.extruderList: for extruder in global_stack.extruderList:
extruder.userChanges.clear() extruder.userChanges.clear()