mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix EA-97656 - NPE: SingleRootFileViewProvider.findElementAt
This commit is contained in:
@@ -447,6 +447,7 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi
|
||||
return document;
|
||||
}
|
||||
|
||||
@SuppressWarnings("MethodDoesntCallSuperMethod")
|
||||
@Override
|
||||
public FileViewProvider clone() {
|
||||
final VirtualFile origFile = getVirtualFile();
|
||||
@@ -513,10 +514,8 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi
|
||||
|
||||
@Nullable
|
||||
public static PsiElement findElementAt(@Nullable PsiElement psiFile, final int offset) {
|
||||
if (psiFile == null) return null;
|
||||
|
||||
ASTNode treeElement = psiFile.getNode().findLeafElementAt(offset);
|
||||
return SourceTreeToPsiMap.treeElementToPsi(treeElement);
|
||||
ASTNode node = psiFile == null ? null : psiFile.getNode();
|
||||
return node == null ? null : SourceTreeToPsiMap.treeElementToPsi(node.findLeafElementAt(offset));
|
||||
}
|
||||
|
||||
public void forceCachedPsi(@NotNull PsiFile psiFile) {
|
||||
|
||||
Reference in New Issue
Block a user