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

4909150: WindowsTreeUI can cause NullPointerException occasionally

Reviewed-by: alexp
上级 dbc02b01
......@@ -81,19 +81,22 @@ public class WindowsTreeUI extends BasicTreeUI {
else {
Rectangle beginRect = getPathBounds(tree, getPathForRow
(tree, beginRow));
Rectangle testRect = beginRect;
int beginY = beginRect.y;
int maxY = beginY + visRect.height;
for(int counter = beginRow + 1; counter <= endRow; counter++) {
testRect = getPathBounds(tree,
getPathForRow(tree, counter));
if((testRect.y + testRect.height) > maxY)
counter = endRow;
if (beginRect != null) {
Rectangle testRect = beginRect;
int beginY = beginRect.y;
int maxY = beginY + visRect.height;
for(int counter = beginRow + 1; counter <= endRow; counter++) {
testRect = getPathBounds(tree,
getPathForRow(tree, counter));
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.
先完成此消息的编辑!
想要评论请 注册