8207938: At step6,Click Add button,case failed automatically.
authormhalder
Wed, 06 Feb 2019 17:28:37 +0530
changeset 53794 c2b366b9c360
parent 53793 9bb638b282bc
child 53795 43c5b0532d49
8207938: At step6,Click Add button,case failed automatically. Reviewed-by: kaddepalli, psadhukhan
src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Tue Feb 05 14:54:06 2019 -0800
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Wed Feb 06 17:28:37 2019 +0530
@@ -208,11 +208,13 @@
 
         CImage cimage = CImage.getCreator().createFromImage(image, observer);
         boolean imageAutoSize = target.isImageAutoSize();
-        cimage.execute(imagePtr -> {
-            execute(ptr -> {
-                setNativeImage(ptr, imagePtr, imageAutoSize);
+        if (cimage != null) {
+            cimage.execute(imagePtr -> {
+                execute(ptr -> {
+                    setNativeImage(ptr, imagePtr, imageAutoSize);
+                });
             });
-        });
+        }
     }
 
     private native void setNativeImage(final long model, final long nsimage, final boolean autosize);
@@ -357,7 +359,7 @@
     class IconObserver implements ImageObserver {
         @Override
         public boolean imageUpdate(Image image, int flags, int x, int y, int width, int height) {
-            if (image != target.getImage()) // if the image has been changed
+            if (target == null || image != target.getImage()) //if the image has been changed
             {
                 return false;
             }