I added a null check in JComponent.paint() to avoid an NPE when the clip
is null. The clip is allowed to be null, but with the GTK peers it seems
it never becomes actually null. I came across this while playing with my
XAWT peers.

2006-05-04  Roman Kennke <[EMAIL PROTECTED]>

        * javax/swing/JComponent.java
        (paint): Added null check to avoid NPE when clip == null.

/Roman

Index: javax/swing/JComponent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.118
diff -u -1 -0 -r1.118 JComponent.java
--- javax/swing/JComponent.java	3 May 2006 14:29:45 -0000	1.118
+++ javax/swing/JComponent.java	4 May 2006 13:19:33 -0000
@@ -1757,22 +1757,23 @@
           {
             g.drawImage(dragBuffer, 0, 0, this);
           }
         else
           {
             Graphics g2 = getComponentGraphics(g);
             paintComponent(g2);
             paintBorder(g2);
             paintChildren(g2);
             Rectangle clip = g2.getClipBounds();
-            if (clip.x == 0 && clip.y == 0 && clip.width == getWidth()
-                && clip.height == getHeight())
+            if (clip == null
+                || (clip.x == 0 && clip.y == 0 && clip.width == getWidth()
+                && clip.height == getHeight()))
               RepaintManager.currentManager(this).markCompletelyClean(this);
           }
       }
   }
 
   /**
    * Initializes the drag buffer by creating a new image and painting this
    * component into it.
    */
   private void initializeDragBuffer()

Reply via email to