From c457f1680ab0c6b2049bbcec9e721ff37bc9109e Mon Sep 17 00:00:00 2001 From: Kukhyeon Heo Date: Sun, 10 Apr 2022 15:43:20 +0900 Subject: [PATCH] [win] Fix crash browsing files when a folder is deleted (fix #2950) --- src/app/file_system.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/file_system.cpp b/src/app/file_system.cpp index e9d64950b..41905592f 100644 --- a/src/app/file_system.cpp +++ b/src/app/file_system.cpp @@ -973,6 +973,13 @@ static FileItem* get_fileitem_by_fullpidl(LPITEMIDLIST fullpidl, bool create_if_ free_pidl(parent_fullpidl); + // The parent folder is sometimes deleted for some reasons. In + // that case, m_parent becomes nullptr, which can causes crash. + if (fileitem->m_parent == nullptr) { + throw std::runtime_error( + "Unexpected file system change. Please check the file."); + } + // Get specific pidl attributes if (fileitem->m_pidl && fileitem->m_parent) {