lkishalmi commented on a change in pull request #2227:
URL: https://github.com/apache/netbeans/pull/2227#discussion_r449120700



##########
File path: platform/openide.util.ui/src/org/openide/util/ImageUtilities.java
##########
@@ -307,8 +307,16 @@ public static final Image mergeImages(Image image1, Image 
image2, int x, int y)
     public static final Icon image2Icon(Image image) {
         /* Make sure to always return a ToolTipImage, to take advantage of its 
rendering tweaks for
         HiDPI screens. */
-        return (image instanceof ToolTipImage)
+        int h = image.getHeight(null);
+        int w = image.getWidth(null);
+        if ((h == -1) || (w == -1)) {
+            // [NETBEANS-4420] Cannot create ToolTipImage from an Image
+            // which size is not yet known.
+            return new ImageIcon(image);
+        } else {
+            return (image instanceof ToolTipImage)
                 ? (ToolTipImage) image : assignToolTipToImageInternal(image, 
"");

Review comment:
       It seems to work, at least no IAE exception has been seen so far. I'll 
mark this one to be backported to 12.0-u1.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to