提交 764f8547 编写于 作者: A alexsch

6671481: NPE at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection

Reviewed-by: serb
上级 07653a70
...@@ -1941,6 +1941,9 @@ public class BasicTreeUI extends TreeUI ...@@ -1941,6 +1941,9 @@ public class BasicTreeUI extends TreeUI
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 == null) {
return;
}
if((testRect.y + testRect.height) > maxY) if((testRect.y + testRect.height) > maxY)
counter = endRow; counter = endRow;
} }
...@@ -2069,7 +2072,7 @@ public class BasicTreeUI extends TreeUI ...@@ -2069,7 +2072,7 @@ public class BasicTreeUI extends TreeUI
treeState.invalidatePathBounds(oldPath); treeState.invalidatePathBounds(oldPath);
updateSize(); updateSize();
} }
else { else if (editingBounds != null) {
editingBounds.x = 0; editingBounds.x = 0;
editingBounds.width = tree.getSize().width; editingBounds.width = tree.getSize().width;
tree.repaint(editingBounds); tree.repaint(editingBounds);
...@@ -2114,6 +2117,9 @@ public class BasicTreeUI extends TreeUI ...@@ -2114,6 +2117,9 @@ public class BasicTreeUI extends TreeUI
tree.isPathSelected(path), tree.isExpanded(path), tree.isPathSelected(path), tree.isExpanded(path),
treeModel.isLeaf(path.getLastPathComponent()), row); treeModel.isLeaf(path.getLastPathComponent()), row);
Rectangle nodeBounds = getPathBounds(tree, path); Rectangle nodeBounds = getPathBounds(tree, path);
if (nodeBounds == null) {
return false;
}
editingRow = row; editingRow = row;
...@@ -2134,6 +2140,9 @@ public class BasicTreeUI extends TreeUI ...@@ -2134,6 +2140,9 @@ public class BasicTreeUI extends TreeUI
// To make sure x/y are updated correctly, fetch // To make sure x/y are updated correctly, fetch
// the bounds again. // the bounds again.
nodeBounds = getPathBounds(tree, path); nodeBounds = getPathBounds(tree, path);
if (nodeBounds == null) {
return false;
}
} }
else else
editorHasDifferentSize = false; editorHasDifferentSize = false;
...@@ -3570,7 +3579,7 @@ public class BasicTreeUI extends TreeUI ...@@ -3570,7 +3579,7 @@ public class BasicTreeUI extends TreeUI
if(pressedPath != null) { if(pressedPath != null) {
Rectangle bounds = getPathBounds(tree, pressedPath); Rectangle bounds = getPathBounds(tree, pressedPath);
if(e.getY() >= (bounds.y + bounds.height)) { if (bounds == null || e.getY() >= (bounds.y + bounds.height)) {
return; return;
} }
...@@ -3832,6 +3841,10 @@ public class BasicTreeUI extends TreeUI ...@@ -3832,6 +3841,10 @@ public class BasicTreeUI extends TreeUI
// And repaint // And repaint
Rectangle newMinBounds = getPathBounds(tree, minPath); Rectangle newMinBounds = getPathBounds(tree, minPath);
if (minBounds == null || newMinBounds == null) {
return;
}
if (indices.length == 1 && if (indices.length == 1 &&
newMinBounds.height == minBounds.height) { newMinBounds.height == minBounds.height) {
tree.repaint(0, minBounds.y, tree.getWidth(), tree.repaint(0, minBounds.y, tree.getWidth(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册