From d15e100b530a481f279919b5a2b6d69b53cb473f Mon Sep 17 00:00:00 2001 From: lunarcleint Date: Sat, 8 Mar 2025 22:49:10 -0700 Subject: [PATCH] fix crash on save --- source/funkin/editors/charter/Charter.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 99e755db..f7bcbf78 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -125,7 +125,7 @@ class Charter extends UIState { }, null,*/ { - label: "Save everything", + label: "Save", keybind: [CONTROL, S], onSelect: _file_save_all, }, @@ -1457,7 +1457,7 @@ class Charter extends UIState { var data = {events: Chart.filterChartForSaving(PlayState.SONG, false, false, true).events}; var path = '${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}/events.json'; - if (data == null || data.events.length == 0) FileSystem.deleteFile(path); // Instead of replacing with a useless empty file, deletes the file directly - Nex + if (FileSystem.exists(path) && (data.events == null || data.events.length == 0)) FileSystem.deleteFile(path); // Instead of replacing with a useless empty file, deletes the file directly - Nex else CoolUtil.safeSaveFile(path, Json.stringify(data, null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null)); #else _file_events_saveas(shouldBuild);