From bc1f9ccded38ca1f18cd33a8fbf81a4d4cf2c2ec Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 1 Jan 2024 20:41:56 +0100 Subject: Fix possible crash when saving file --- src/QuickMedia.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index a555ab8..84f921f 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -8304,10 +8304,12 @@ namespace QuickMedia { std::string output_filepath_s = output_filepath; char *output_dir = dirname(output_filepath_s.data()); - if(create_directory_recursive(output_dir) != 0) { - show_notification("QuickMedia", std::string("Failed to download ") + url + " to " + output_filepath + " (failed to create directory)", Urgency::CRITICAL); - exit_code = 1; - return; + if(strcmp(output_dir, ".") != 0 && strcmp(output_dir, "/") != 0) { + if(create_directory_recursive(output_dir) != 0) { + show_notification("QuickMedia", std::string("Failed to download ") + url + " to " + output_filepath + " (failed to create directory)", Urgency::CRITICAL); + exit_code = 1; + return; + } } idle_active_handler(); -- cgit v1.2.3