diff --git a/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java b/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java index 514bc9d563ce..0739893e95a4 100644 --- a/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java @@ -561,13 +561,13 @@ public class PyUnresolvedReferencesInspection extends PyInspection { final PsiElement point; final TextRange range; - if (reference instanceof PyOperatorReference) { + final PsiElement lastChild = node.getLastChild(); + if (reference instanceof PyOperatorReference || lastChild == null) { point = node; range = rangeInElement; } else { - final PsiElement lastChild = node.getLastChild(); - point = lastChild != null ? lastChild : node; // usually the identifier at the end of qual ref + point = lastChild; // usually the identifier at the end of qual ref range = rangeInElement.shiftRight(-point.getStartOffsetInParent()); } if (reference instanceof PyImportReference && refname != null) {