I added a null check in the GdkGraphics2D constructor to avoid an NPE if
the source GdkGraphics2D object has a null bg field.

2006-01-10  Roman Kennke  <[EMAIL PROTECTED]>

        * gnu/java/awt/peer/gtk/GdkGraphics2D.java
        (GdkGraphics2D(GdkGraphics2D)): Added null check for the bg
        field to avoid NPE.

/Roman
Index: gnu/java/awt/peer/gtk/GdkGraphics2D.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java,v
retrieving revision 1.53
diff -u -r1.53 GdkGraphics2D.java
--- gnu/java/awt/peer/gtk/GdkGraphics2D.java	3 Jan 2006 22:45:29 -0000	1.53
+++ gnu/java/awt/peer/gtk/GdkGraphics2D.java	10 Jan 2006 12:33:26 -0000
@@ -180,11 +180,14 @@
     else
       fg = new Color(g.fg.getRGB());
 
-    if (g.bg.getAlpha() != -1)
-      bg = new Color(g.bg.getRed(), g.bg.getGreen(), g.bg.getBlue(),
-                     g.bg.getAlpha());
-    else
-      bg = new Color(g.bg.getRGB());
+    if (g.bg != null)
+      {
+        if (g.bg.getAlpha() != -1)
+          bg = new Color(g.bg.getRed(), g.bg.getGreen(), g.bg.getBlue(),
+                         g.bg.getAlpha());
+        else
+          bg = new Color(g.bg.getRGB());
+      }
 
     if (g.clip == null)
       clip = null;
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to