Skip to content

Commit

Permalink
Don't fail ModernSHBrowseForFolderW when DefaultFolder cannot be set. (
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhngtu authored Dec 8, 2024
1 parent 8df266d commit e54855e
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions NanaZip.Shared/ModernWin32FileBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,22 @@ EXTERN_C PIDLIST_ABSOLUTE WINAPI ModernSHBrowseForFolderW(
nullptr,
IID_PPV_ARGS(&DefaultFolder))))
{
if (SUCCEEDED(FileDialog->SetDefaultFolder(
DefaultFolder)))
FileDialog->SetDefaultFolder(DefaultFolder);

DefaultFolder->Release();
}

if (SUCCEEDED(FileDialog->Show(
lpbi->hwndOwner)))
{
IShellItem* Result = nullptr;
if (SUCCEEDED(FileDialog->GetResult(
&Result)))
{
if (SUCCEEDED(FileDialog->Show(
lpbi->hwndOwner)))
{
IShellItem* Result = nullptr;
if (SUCCEEDED(FileDialog->GetResult(
&Result)))
{
::SHGetIDListFromObject(Result, &IDList);
::SHGetIDListFromObject(Result, &IDList);

Result->Release();
}
}
Result->Release();
}

DefaultFolder->Release();
}
}
}
Expand Down

0 comments on commit e54855e

Please sign in to comment.