You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/07/02 15:45:51 UTC

[GitHub] [netbeans] lkishalmi commented on a change in pull request #2227: [NETBEANS-4420] Fix IAE on tooltip images with unknown size.

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



##########
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:
       Well, I can try that.
   Would it be good for the 
   model.createCompatibleWritableRaster(w, h) (Line:1079)?
   Actually that is where the original IAE is coming from if the size of the unknown.
   Going to try that anyway...




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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