diff options
author | Daste <stefankar1000@gmail.com> | 2022-02-10 00:21:09 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-10 18:42:45 +0100 |
commit | 11c53a194424d671e8ecd594dd3f86c7025ed61b (patch) | |
tree | 038d293c606b021459206357dcf91ea0310fc4cb | |
parent | a9b387a1bff0a21438ba7e0c5ecefa4eae15d192 (diff) | |
download | serenity-11c53a194424d671e8ecd594dd3f86c7025ed61b.zip |
HackStudio: Don't save file when filename is empty
When saving a new file, save_as_action will return if the filename
input was empty, but save_action would still try to save the file.
Added a guard to make sure we never try to save files with empty
filenames.
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index f9868fd425..ff1bf6de40 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -695,7 +695,9 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_action() if (active_file().is_empty()) m_save_as_action->activate(); - current_editor_wrapper().save(); + // NOTE active_file() could still be empty after a cancelled save_as_action + if (!active_file().is_empty()) + current_editor_wrapper().save(); if (m_git_widget->initialized()) m_git_widget->refresh(); |