mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Don't attempt writing a workspace before there is a global stack
This is normally not possible from the interface. However on MacOS, the application menu gets carried to the top bar of the operating system. It is not blocked there, and the user could write a project file before they even add a printer. This prevents Cura from crashing when they do that. Fixes Sentry issue CURA-2ZR.
This commit is contained in:
parent
cecd033430
commit
2f1c157547
1 changed files with 6 additions and 1 deletions
|
@ -32,6 +32,12 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
|||
Logger.error("3MF Writer class is unavailable. Can't write workspace.")
|
||||
return False
|
||||
|
||||
global_stack = machine_manager.activeMachine
|
||||
if global_stack is None:
|
||||
self.setInformation(catalog.i18nc("@error", "There is no workspace yet to write. Please add a printer first."))
|
||||
Logger.error("Tried to write a 3MF workspace before there was a global stack.")
|
||||
return False
|
||||
|
||||
# Indicate that the 3mf mesh writer should not close the archive just yet (we still need to add stuff to it).
|
||||
mesh_writer.setStoreArchive(True)
|
||||
mesh_writer.write(stream, nodes, mode)
|
||||
|
@ -40,7 +46,6 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
|||
if archive is None: # This happens if there was no mesh data to write.
|
||||
archive = zipfile.ZipFile(stream, "w", compression = zipfile.ZIP_DEFLATED)
|
||||
|
||||
global_stack = machine_manager.activeMachine
|
||||
|
||||
try:
|
||||
# Add global container stack data to the archive.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue