From 802e9264462e4dd346d2af254f64862675028e81 Mon Sep 17 00:00:00 2001 From: Laszlo Kishalmi Date: Wed, 1 Jul 2020 21:04:48 -0700 Subject: [PATCH] [NETBEANS-4420] Fix IAE on tooltip images with unknown size. --- platform/openide.util.ui/manifest.mf | 2 +- .../src/org/openide/util/ImageUtilities.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/openide.util.ui/manifest.mf b/platform/openide.util.ui/manifest.mf index fd9ee98f8141..0f3a393a03b7 100644 --- a/platform/openide.util.ui/manifest.mf +++ b/platform/openide.util.ui/manifest.mf @@ -1,5 +1,5 @@ Manifest-Version: 1.0 OpenIDE-Module: org.openide.util.ui OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties -OpenIDE-Module-Specification-Version: 9.16 +OpenIDE-Module-Specification-Version: 9.16.1 diff --git a/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java b/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java index 5a24b7022362..d9d613cb470d 100644 --- a/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java +++ b/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java @@ -811,8 +811,8 @@ private static final ToolTipImage doMergeImages(Image image1, Image image2, int ensureLoaded(image1); ensureLoaded(image2); - int w = Math.max(image1.getWidth(null), x + image2.getWidth(null)); - int h = Math.max(image1.getHeight(null), y + image2.getHeight(null)); + int w = Math.max(1, Math.max(image1.getWidth(null), x + image2.getWidth(null))); + int h = Math.max(1, Math.max(image1.getHeight(null), y + image2.getHeight(null))); boolean bitmask = (image1 instanceof Transparency) && ((Transparency)image1).getTransparency() != Transparency.TRANSLUCENT && (image2 instanceof Transparency) && ((Transparency)image2).getTransparency() != Transparency.TRANSLUCENT; @@ -1064,8 +1064,8 @@ public static ToolTipImage createNew(String toolTipText, Image image, URL url) { ImageUtilities.ensureLoaded(image); boolean bitmask = (image instanceof Transparency) && ((Transparency) image).getTransparency() != Transparency.TRANSLUCENT; ColorModel model = colorModel(bitmask ? Transparency.BITMASK : Transparency.TRANSLUCENT); - int w = image.getWidth(null); - int h = image.getHeight(null); + int w = Math.max(1, image.getWidth(null)); + int h = Math.max(1, image.getHeight(null)); if (url == null) { Object value = image.getProperty("url", null); url = (value instanceof URL) ? (URL) value : null;