From c96adcf557597a712582b09eee62978ad479f2b7 Mon Sep 17 00:00:00 2001 From: ackwell Date: Fri, 3 May 2024 21:15:00 +1000 Subject: [PATCH] Prevent saving invalid files --- Penumbra/UI/AdvancedWindow/FileEditor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Penumbra/UI/AdvancedWindow/FileEditor.cs b/Penumbra/UI/AdvancedWindow/FileEditor.cs index c891d33a..66f38bab 100644 --- a/Penumbra/UI/AdvancedWindow/FileEditor.cs +++ b/Penumbra/UI/AdvancedWindow/FileEditor.cs @@ -204,8 +204,9 @@ public class FileEditor( private void SaveButton() { + var canSave = _changed && _currentFile != null && _currentFile.Valid; if (ImGuiUtil.DrawDisabledButton("Save to File", Vector2.Zero, - $"Save the selected {fileType} file with all changes applied. This is not revertible.", !_changed)) + $"Save the selected {fileType} file with all changes applied. This is not revertible.", !canSave)) { compactor.WriteAllBytes(_currentPath!.File.FullName, _currentFile!.Write()); if (owner.Mod != null)