From 5fe59d132cb345c65fdc4bb87c6cab1d60e65205 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Wed, 7 Aug 2013 19:57:18 +0400 Subject: [PATCH] 7124339: [macosx] setIconImage is not endlessly tolerant to the broken image-arguments Reviewed-by: alexsch, leonidr --- .../sun/lwawt/macosx/CPlatformWindow.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 8aed7e5feaa..d38946d4376 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -830,18 +830,19 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo // UTILITY METHODS // ---------------------------------------------------------------------- - /* - * Find image to install into Title or into Application icon. - * First try icons installed for toplevel. If there is no icon - * use default Duke image. - * This method shouldn't return null. + /** + * Find image to install into Title or into Application icon. First try + * icons installed for toplevel. Null is returned, if there is no icon and + * default Duke image should be used. */ private CImage getImageForTarget() { - List icons = target.getIconImages(); - if (icons == null || icons.size() == 0) { - return null; + CImage icon = null; + try { + icon = CImage.getCreator().createFromImages(target.getIconImages()); + } catch (Exception ignored) { + // Perhaps the icon passed into Java is broken. Skipping this icon. } - return CImage.getCreator().createFromImages(icons); + return icon; } /*