On Tue, 17 Dec 2024 14:49:34 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> I'd leave it out here. As @azuev-java [notes 
>> above](https://github.com/openjdk/jdk/pull/22776/files#r1887863199), the 
>> likely problem is `hIcon == 0` rather than `makeIcon` returns `null`.
>
>> > Although `icon != null` check is not strictly required here due to `hIcon 
>> > != 0` check, added it as sanity check and to be consistent with other 
>> > locations in Win32ShellFolder2.java where makeIcon() is called (which is 
>> > followed by a null check for the returned icon).
>> 
>> I'd leave it out here. As @azuev-java [notes 
>> above](https://github.com/openjdk/jdk/pull/22776/files#r1887863199), the 
>> likely problem is `hIcon == 0` rather than `makeIcon` returns `null`.
> 
> Now that I've thought about it more, you're right `icon != null` is also 
> needed… if the icon bits can't be extracted which can also occur if *GDI 
> resources are exhausted*.

Then i would suggest doing both checks in both places. No need to even try to 
extract icon bits for hIcon == 0 but if we failed to extract icon for the 
correct handle we should handle it too.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22776#discussion_r1888900624

Reply via email to