Skip to content

Commit

Permalink
[NETBEANS-4420] Fix IAE on tooltip images with unknown size.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkishalmi committed Jul 7, 2020
1 parent 143ef55 commit 802e926
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion platform/openide.util.ui/manifest.mf
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 802e926

Please sign in to comment.