diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-01-01 20:41:56 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-01-01 20:41:56 +0100 |
commit | bc1f9ccded38ca1f18cd33a8fbf81a4d4cf2c2ec (patch) | |
tree | b0a496eb9468182514c3e6b61f7440736da5ddac /src | |
parent | 7e7a8f314b1cac4cce96e781604a874b5533f690 (diff) |
Fix possible crash when saving file
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
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(); |