jdk/src/java.desktop/share/classes/sun/awt/image/OffScreenImageSource.java
changeset 39842 459c9c8a5a68
parent 39022 2ad6ba4c7174
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/OffScreenImageSource.java	Thu Jul 07 15:39:19 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/OffScreenImageSource.java	Fri Jul 08 11:15:46 2016 +0530
@@ -187,17 +187,19 @@
             sendPixels();
             theConsumer.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
 
-            try {
-                theConsumer.imageComplete(ImageConsumer.STATICIMAGEDONE);
-            } catch (RuntimeException e) {
-                // We did not previously call this method here and
-                // some image consumer filters were not prepared for it to be
-                // called at this time. We allow them to have runtime issues
-                // for this one call only without triggering the IMAGEERROR
-                // condition below.
-                e.printStackTrace();
+            // If 'theconsumer' has not unregistered itself after previous call
+            if (theConsumer != null) {
+                try {
+                    theConsumer.imageComplete(ImageConsumer.STATICIMAGEDONE);
+                } catch (RuntimeException e) {
+                    // We did not previously call this method here and
+                    // some image consumer filters were not prepared for it to be
+                    // called at this time. We allow them to have runtime issues
+                    // for this one call only without triggering the IMAGEERROR
+                    // condition below.
+                    e.printStackTrace();
+                }
             }
-
         } catch (NullPointerException e) {
             e.printStackTrace();