Fixed a NullPointerException

2005-10-18  Lillian Angel  <[EMAIL PROTECTED]>

        * java/awt/GridBagLayout.java
        (GetLayoutInfo): Added a null check for lastComponent. Prevents
        NPE.

Index: java/awt/GridBagLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/GridBagLayout.java,v
retrieving revision 1.21
diff -u -r1.21 GridBagLayout.java
--- java/awt/GridBagLayout.java	5 Aug 2005 17:16:52 -0000	1.21
+++ java/awt/GridBagLayout.java	18 Oct 2005 20:02:35 -0000
@@ -705,17 +705,20 @@
                       if (lastInCol.containsKey(new Integer(x)))
                         {
                           Component lastComponent = (Component) lastInRow.get(new Integer(x));
-                          GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
-
-                          if (lastConstraints.gridheight == GridBagConstraints.RELATIVE)
+                          if (lastComponent != null)
                             {
-                              constraints.gridy = max_y - 1;
-                              break;
-                            }
-                          else
-                            {
-                              constraints.gridy = Math.max (constraints.gridy,
-                                                            lastConstraints.gridy + Math.max (1, lastConstraints.gridheight));
+                              GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+    
+                              if (lastConstraints.gridheight == GridBagConstraints.RELATIVE)
+                                {
+                                  constraints.gridy = max_y - 1;
+                                  break;
+                                }
+                              else
+                                {
+                                  constraints.gridy = Math.max (constraints.gridy,
+                                                                lastConstraints.gridy + Math.max (1, lastConstraints.gridheight));
+                                }
                             }
                         }
                     }
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to