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

4909150: WindowsTreeUI can cause NullPointerException occasionally

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