DocumentationManager.findTargeElement() can be executed when index is not ready, so let's catch INRE and return null

This commit is contained in:
Oleg Sukhodolsky
2013-04-16 17:24:42 +04:00
parent 03babbf020
commit 742cbbd4ef
@@ -528,6 +528,21 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
@Nullable
public PsiElement findTargetElement(final Editor editor, int offset, @Nullable final PsiFile file, PsiElement contextElement) {
try {
return findTargetElementUnsafe(editor, offset, file, contextElement);
}
catch (IndexNotReadyException inre) {
LOG.warn("Index not ready");
LOG.debug(inre);
return null;
}
}
/**
* in case index is not ready will throw IndexNotReadyException
*/
@Nullable
private PsiElement findTargetElementUnsafe(final Editor editor, int offset, @Nullable final PsiFile file, PsiElement contextElement) {
TargetElementUtilBase util = TargetElementUtilBase.getInstance();
PsiElement element = assertSameProject(getElementFromLookup(editor, file));
if (element == null && file != null) {