8207938: At step6,Click Add button,case failed automatically.
Reviewed-by: kaddepalli, psadhukhan
--- 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;
}