From 0c09617b48cd3200a5849edef28372a3a722bfe5 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 4 Jan 2022 18:07:06 +0100 Subject: [PATCH] LibGUI: Don't show "last saved" information for never-saved documents When showing the "unsaved changes" dialog for an empty path, we should say "last saved at ..." since that would be a lie. --- Userland/Libraries/LibGUI/MessageBox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/MessageBox.cpp b/Userland/Libraries/LibGUI/MessageBox.cpp index 9f395762b9..1c91b7fd7d 100644 --- a/Userland/Libraries/LibGUI/MessageBox.cpp +++ b/Userland/Libraries/LibGUI/MessageBox.cpp @@ -37,7 +37,7 @@ int MessageBox::ask_about_unsaved_changes(Window* parent_window, StringView path builder.appendff("\"{}\"", LexicalPath::basename(path)); builder.append(" before closing?"); - if (last_unmodified_timestamp.has_value()) { + if (!path.is_empty() && last_unmodified_timestamp.has_value()) { auto age = (Time::now_monotonic() - *last_unmodified_timestamp).to_seconds(); builder.appendff("\nLast saved {} second{} ago.", age, age == 1 ? "" : "s"); }