On Mon, 19 Dec 2022 13:29:46 GMT, Tejesh R <[email protected]> wrote:

> > You may still add `assert` statements into `MultiResolutionIconImage` 
> > constructors which ensures `resolutionVariants` contains no `null` values.
> 
> Will add assert statements in this `public MultiResolutionIconImage(int 
> baseSize, Image image)` as null checks are handled in other constructor.

What do you mean?

There are no `null`-checks in the other constructor. Or do I miss anything?

It's just you don't call the other constructor any more if an icon fetched from 
the OS is `null`. (Perhaps, it's not the most effective way: if another icon 
size is extracted correctly, a non-null value could still be returned.)

The following statement


assert !resolutionVariants.containsValue(null) : "There are null icons in the 
variants map";


would still prevent a `MultiResolutionIconImage` from being created if any 
resolution variant contains `null`. The code above could change again and we 
may end up with the same problem again.

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

PR: https://git.openjdk.org/jdk/pull/11104

Reply via email to