[win] Fix crash browsing files when a folder is deleted (fix #2950)

This commit is contained in:
Kukhyeon Heo 2022-04-10 15:43:20 +09:00 committed by David Capello
parent f886e85af9
commit c457f1680a

View File

@ -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) {