Index: java/awt/image/PixelGrabber.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/image/PixelGrabber.java,v retrieving revision 1.13 diff -u -r1.13 PixelGrabber.java --- java/awt/image/PixelGrabber.java 2 Jul 2005 20:32:36 -0000 1.13 +++ java/awt/image/PixelGrabber.java 18 Aug 2005 13:34:37 -0000 @@ -131,6 +131,9 @@ public PixelGrabber(ImageProducer ip, int x, int y, int w, int h, int pix[], int off, int scansize) { + if (ip == null) + throw new NullPointerException("The ImageProducer must not be null."); + this.ip = ip; this.x = x; this.y = y; @@ -179,6 +182,10 @@ boolean forceRGB) { this.ip = img.getSource(); + + if (this.ip == null) + throw new NullPointerException("The ImageProducer must not be null."); + this.x = x; this.y = y; width = w; @@ -209,7 +216,15 @@ { public void run () { - ip.startProduction (PixelGrabber.this); + try + { + ip.startProduction (PixelGrabber.this); + } + catch (Exception ex) + { + ex.printStackTrace(); + imageComplete(ImageConsumer.ABORTED); + } } }; grabberThread.start (); @@ -601,7 +616,8 @@ consumerStatus = status; setObserverStatus (); grabbing = false; - ip.removeConsumer (this); + if (ip != null) + ip.removeConsumer (this); notifyAll (); }