提交 8abf525c 编写于 作者: R rupashka

4909150: WindowsTreeUI can cause NullPointerException occasionally

Reviewed-by: alexp
上级 dbc02b01
...@@ -81,6 +81,7 @@ public class WindowsTreeUI extends BasicTreeUI { ...@@ -81,6 +81,7 @@ public class WindowsTreeUI extends BasicTreeUI {
else { else {
Rectangle beginRect = getPathBounds(tree, getPathForRow Rectangle beginRect = getPathBounds(tree, getPathForRow
(tree, beginRow)); (tree, beginRow));
if (beginRect != null) {
Rectangle testRect = beginRect; Rectangle testRect = beginRect;
int beginY = beginRect.y; int beginY = beginRect.y;
int maxY = beginY + visRect.height; int maxY = beginY + visRect.height;
...@@ -88,15 +89,17 @@ public class WindowsTreeUI extends BasicTreeUI { ...@@ -88,15 +89,17 @@ public class WindowsTreeUI extends BasicTreeUI {
for(int counter = beginRow + 1; counter <= endRow; counter++) { for(int counter = beginRow + 1; counter <= endRow; counter++) {
testRect = getPathBounds(tree, testRect = getPathBounds(tree,
getPathForRow(tree, counter)); getPathForRow(tree, counter));
if((testRect.y + testRect.height) > maxY) if(testRect != null && (testRect.y + testRect.height) > maxY) {
counter = endRow; counter = endRow;
} }
}
tree.scrollRectToVisible(new Rectangle(visRect.x, beginY, 1, tree.scrollRectToVisible(new Rectangle(visRect.x, beginY, 1,
testRect.y + testRect.height- testRect.y + testRect.height-
beginY)); beginY));
} }
} }
} }
}
static protected final int HALF_SIZE = 4; static protected final int HALF_SIZE = 4;
static protected final int SIZE = 9; static protected final int SIZE = 9;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册