[PSI] Ignore when failed to get file text

This is change from 36ff952 which was forgotten when applying 203 bunch
This commit is contained in:
Dmitriy Novozhilov
2021-07-09 14:07:26 +03:00
committed by teamcityserver
parent daa4c708a2
commit 785e2f862c
@@ -59,7 +59,15 @@ public class KtElementImplStub<T extends StubElement<?>> 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()) : "");