-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ShellItemImages.GetImageAsync might throw NullReferenceException #414
Comments
dahall
added a commit
that referenced
this issue
Jul 7, 2023
I applied what I think is a fix for the NRE -- many more null checks. On your second point about wrapping the function in |
@dahall What I mean is that public SafeHBITMAP GetImage(SIZE size, ShellItemGetImageOptions flags) => Images.GetImage(size, flags); |
Done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug and how to reproduce
Recently, I got some stacktrace and found that
ShellItemImages.GetImageAsync
might throw NRE.Although the stacktrace do not show any useful information, but I think this issue might be related to the ShellItem.Parent. ShellItem.Parent might return null.
Vanara/Windows.Shell.Common/ShellObjects/ShellItemImages.cs
Lines 50 to 64 in f66686c
Vanara/Windows.Shell.Common/ShellObjects/ShellItem.cs
Lines 502 to 509 in f66686c
What code is involved
Expected behavior
Should not throw NullReferenceException
By the way, it would be better to call the sync function directly rather than wait for Task.Result here, you simply warp the function in Task.Run()
Vanara/Windows.Shell.Common/ShellObjects/ShellItem.cs
Line 699 in f66686c
Vanara/Windows.Shell.Common/ShellObjects/ShellItemImages.cs
Line 30 in f66686c
The text was updated successfully, but these errors were encountered: