Skip to content

Commit 0b6a244

Browse files
authored
Merge pull request #2530 from digma-ai/fix-fatal-error-invalid-virtual-file
fix-fatal-error-invalid-virtual-file
2 parents b4812ff + 5ae20ab commit 0b6a244

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ide-common/src/main/java/org/digma/intellij/plugin/editor/CurrentContextUpdater.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,13 @@ private void updateCurrentContext(@NotNull Editor editor, int caretOffset, Virtu
8282
//there is no need to check if file is supported, we install caret listener only on editors of supported files.
8383
Log.log(LOGGER::debug, "updateCurrentContext for editor:{}, file: {}", editor, file);
8484

85-
PsiFile psiFile = PsiAccessUtilsKt.runInReadAccessWithResult(() -> PsiManager.getInstance(project).findFile(file));
85+
PsiFile psiFile = PsiAccessUtilsKt.runInReadAccessWithResult(() -> {
86+
if (VfsUtilsKt.isValidVirtualFile(file)) {
87+
return PsiManager.getInstance(project).findFile(file);
88+
}else{
89+
return null;
90+
}
91+
});
8692

8793
if (!PsiUtils.isValidPsiFile(psiFile)) {
8894
Log.log(LOGGER::debug, "psi file not found or is not valid for file: {}", file);

0 commit comments

Comments
 (0)