who gives us invalid PSI to highlight usages of? (EA-85215)

This commit is contained in:
peter
2016-06-30 18:59:51 +02:00
parent 88ec350212
commit d2e15e5965
@@ -107,11 +107,17 @@ public class IdentifierHighlighterPass extends TextEditorHighlightingPass {
} else {
PsiReference ref = TargetElementUtil.findReference(myEditor);
if (ref instanceof PsiPolyVariantReference) {
if (!ref.getElement().isValid()) {
throw new PsiInvalidElementAccessException(ref.getElement(), "Invalid element in " + ref + " of " + ref.getClass() + "; editor=" + myEditor);
}
ResolveResult[] results = ((PsiPolyVariantReference)ref).multiResolve(false);
if (results.length > 0) {
for (ResolveResult result : results) {
PsiElement target = result.getElement();
if (target != null) {
if (!target.isValid()) {
throw new PsiInvalidElementAccessException(target, "Invalid element returned from " + ref + " of " + ref.getClass() + "; editor=" + myEditor);
}
highlightTargetUsages(target);
}
}