Fix crash when closing game within stage editor

This commit is contained in:
VirtuGuy
2026-01-29 22:07:58 -07:00
committed by Hundrec
parent 8954dee6d6
commit cda1ca6897
@@ -855,7 +855,7 @@ class StageEditorState extends UIState
if (!saved)
{
trace("You haven't saved recently, so a backup will be made.");
saveBackup();
saveBackup(true);
}
}
@@ -866,7 +866,7 @@ class StageEditorState extends UIState
if (!saved)
{
trace("You haven't saved recently, so a backup will be made.");
saveBackup();
saveBackup(true);
}
}
@@ -1498,7 +1498,7 @@ class StageEditorState extends UIState
}
}
function saveBackup()
function saveBackup(isClose:Bool = false)
{
FileUtil.createDirIfNotExists(BACKUPS_PATH);
@@ -1509,12 +1509,16 @@ class StageEditorState extends UIState
]);
FileUtil.writeBytesToPath(path, data);
saved = true;
if (!isClose)
{
saved = true;
notifyChange("Auto-Save", "A Backup of this Stage has been made.");
}
Save.instance.stageEditorHasBackup.value = true;
Save.system.flush();
notifyChange("Auto-Save", "A Backup of this Stage has been made.");
}
public function clearAssets()