Skip to content

Commit

Permalink
CAMELCADE-2124 Do not attempt to find target for invalid element
Browse files Browse the repository at this point in the history
#CAMELCADE-2124 Fixed
  • Loading branch information
hurricup committed Oct 4, 2023
1 parent 4998a34 commit 54a39e6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public PerlHighlightUsagesHandler(@NotNull Editor editor, @NotNull PsiFile file,

@Override
public @NotNull List<PsiElement> getTargets() {
PsiElement namedElement =
TargetElementUtil.getInstance().getNamedElement(myElement, myOriginalEditorOffset - myElement.getNode().getStartOffset());
PsiElement namedElement = myElement.isValid() ?
TargetElementUtil.getInstance().getNamedElement(myElement, myOriginalEditorOffset - myElement.getNode().getStartOffset()) : null;
if (namedElement != null) {
return collectReferenceTargets(ReferencesSearch.search(namedElement, new LocalSearchScope(myFile)).findFirst());
}
Expand Down

0 comments on commit 54a39e6

Please sign in to comment.