psi viewer fix possible npe

This commit is contained in:
anstarovoyt
2018-11-08 16:16:19 +03:00
parent 99ea15fd17
commit 60f087a7cd
@@ -257,7 +257,10 @@ public class BlockViewerPsiBasedTree implements ViewerPsiBasedTree {
return null;
}
BlockTreeNode node = (BlockTreeNode)getRoot().getUserObject();
DefaultMutableTreeNode root = getRoot();
if (root == null) return null;
BlockTreeNode node = (BlockTreeNode)root.getUserObject();
main_loop:
while (true) {
if (node.getBlock().getTextRange().equals(range)) {
@@ -316,6 +319,7 @@ public class BlockViewerPsiBasedTree implements ViewerPsiBasedTree {
}
}
@Nullable
private DefaultMutableTreeNode getRoot() {
return (DefaultMutableTreeNode)myBlockTree.getModel().getRoot();
}