From c741db967c72fd0c67d6fc344cd57668ede4de11 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Mon, 18 Apr 2022 17:39:37 +0200 Subject: [PATCH] CrashReporter: Don't display an error when cancelling backtrace saving Pressing the cancel button on the prompt displayed by try_save_file() used to show an error. --- Userland/Applications/CrashReporter/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp index 6fcc1f86b5..e7993e7874 100644 --- a/Userland/Applications/CrashReporter/main.cpp +++ b/Userland/Applications/CrashReporter/main.cpp @@ -284,13 +284,12 @@ ErrorOr serenity_main(Main::Arguments arguments) LexicalPath lexical_path(String::formatted("{}_{}_backtrace.txt", pid, app_name)); auto file_or_error = FileSystemAccessClient::Client::the().try_save_file(window, lexical_path.title(), lexical_path.extension()); - if (file_or_error.is_error()) { - GUI::MessageBox::show(window, String::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed", GUI::MessageBox::Type::Error); + if (file_or_error.is_error()) return; - } auto file = file_or_error.value(); - file->write(full_backtrace.to_string()); + if (!file->write(full_backtrace.to_string())) + GUI::MessageBox::show(window, String::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed", GUI::MessageBox::Type::Error); }; (void)Threading::BackgroundAction::construct(