2005-11-16  Lillian Angel  <[EMAIL PROTECTED]>

        * javax/swing/plaf/basic/BasicTreeUI.java
        (paintVerticalPartOfLeg): Added a check to prevent
        ArrayOutOfBoundsException.

Index: javax/swing/plaf/basic/BasicTreeUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.114
diff -u -r1.114 BasicTreeUI.java
--- javax/swing/plaf/basic/BasicTreeUI.java	15 Nov 2005 21:58:49 -0000	1.114
+++ javax/swing/plaf/basic/BasicTreeUI.java	16 Nov 2005 16:53:39 -0000
@@ -3560,13 +3560,13 @@
       {
         Object curr = path.getPathComponent(i);
         TreePath currPath = new TreePath(getPathToRoot(curr, 0));
-        if (!treeModel.isLeaf(curr) && tree.isExpanded(currPath))
+        int numChild = treeModel.getChildCount(curr);
+        if (numChild > 0 && tree.isExpanded(currPath))
           {
             Rectangle bounds = getPathBounds(tree, currPath);
             Rectangle lastChildBounds = getPathBounds(tree, 
                                         new TreePath(getPathToRoot(
-                                        treeModel.getChild(curr, 
-                                        treeModel.getChildCount(curr) - 1), 
+                                        treeModel.getChild(curr, numChild - 1), 
                                         0)));
             paintVerticalLine(g, tree, bounds.x + gap + 2, bounds.y + 
                               bounds.height - 2, lastChildBounds.y + 
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to