From 785e2f862cbfc460e9efbe624cc4ff495fe5eece Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 9 Jul 2021 14:07:26 +0300 Subject: [PATCH] [PSI] Ignore when failed to get file text This is change from 36ff952 which was forgotten when applying 203 bunch --- .../org/jetbrains/kotlin/psi/KtElementImplStub.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java index f802e8d3341..84f5ee7c916 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtElementImplStub.java @@ -59,7 +59,15 @@ public class KtElementImplStub> extends StubBasedPsiEle PsiFile file = getContainingFile(); if (!(file instanceof KtFile)) { // KtElementImpl.copy() might be the reason for this exception - String fileString = file.isValid() ? (" " + file.getText()) : ""; + String fileString = ""; + if (file.isValid()) { + try { + fileString = " " + file.getText(); + } + catch (Exception e) { + // ignore when failed to get file text + } + } // getNode() will fail if getContainingFile() returns not PsiFileImpl instance String nodeString = (file instanceof PsiFileImpl ? (" node = " + getNode()) : "");