From 3fc9bfb350737ad31914d9cee00080c2d4908a07 Mon Sep 17 00:00:00 2001 From: jinjiaodawang Date: Tue, 8 Oct 2024 02:52:43 +0800 Subject: [PATCH] fix #481, determine whether the file exists when comparing files --- pdf_viewer/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pdf_viewer/main.cpp b/pdf_viewer/main.cpp index 744aed648..b1beb8e24 100644 --- a/pdf_viewer/main.cpp +++ b/pdf_viewer/main.cpp @@ -398,8 +398,10 @@ MainWidget* get_window_with_opened_file_path(const std::wstring& file_path) { std::string path1 = utf8_encode(window->doc()->get_path()); std::string path2 = utf8_encode(file_path); #endif - if (std::filesystem::equivalent(path1, path2)) { - return window; + if (std::filesystem::exists(path1) && std::filesystem::exists(path2)) { + if (std::filesystem::equivalent(path1, path2)) { + return window; + } } } }