GridLayout.java (layoutContainer): Handle case where there are no items in container.
authorTom Tromey <tromey@redhat.com>
Sun, 10 Mar 2002 18:15:58 +0000 (18:15 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Sun, 10 Mar 2002 18:15:58 +0000 (18:15 +0000)
* java/awt/GridLayout.java (layoutContainer): Handle case where
there are no items in container.

From-SVN: r50539

libjava/ChangeLog
libjava/java/awt/GridLayout.java

index 205b8b3aa44f9abcbe1bb90080d55fa73567095a..3dbb9941e69833321a78b8b7b70aca6694a8cb66 100644 (file)
@@ -1,5 +1,8 @@
 2002-03-10  Tom Tromey  <tromey@redhat.com>
 
+       * java/awt/GridLayout.java (layoutContainer): Handle case where
+       there are no items in container.
+
        * java/lang/Win32Process.java: Added comment.
        * include/posix.h (_Jv_platform_close_on_exec): New function.
        Include fcntl.h.
index 347186536cb9b2631d1b03a5897affd371f96896..32f1cf8f5f4dce4bf32ad659022ccfad12614327 100644 (file)
@@ -152,6 +152,12 @@ public class GridLayout implements LayoutManager, Serializable
   public void layoutContainer (Container parent)
   {
     int num = parent.ncomponents;
+
+    // There's no point, and handling this would mean adding special
+    // cases.
+    if (num == 0)
+      return;
+
     // This is more efficient than calling getComponents().
     Component[] comps = parent.component;