Skip to content

Commit

Permalink
Fixed #488 that ShellFolder.EnumerateChildIds might throw NullReferen…
Browse files Browse the repository at this point in the history
…ceException if failed to enum the objects (#499)
  • Loading branch information
zhuxb711 authored Jan 11, 2025
1 parent ba5cd30 commit 4dbda7f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Windows.Shell.Common/ShellObjects/ShellFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ public IEnumerable<ShellItem> EnumerateChildren(FolderItemFilter filter /*= Fold
public IEnumerable<PIDL> EnumerateChildIds(FolderItemFilter filter /*= FolderItemFilter.Folders | FolderItemFilter.IncludeHidden | FolderItemFilter.NonFolders | FolderItemFilter.IncludeSuperHidden */, HWND parentWindow = default, int fetchSize = 20)
{
if (iShellFolder.EnumObjects(parentWindow, (SHCONTF)filter, out var eo).Failed)
{
Debug.WriteLine($"Unable to enum children in folder.");
yield break;
}

try
{
foreach (PIDL p in eo!.Enumerate(fetchSize))
Expand Down

0 comments on commit 4dbda7f

Please sign in to comment.