From 4ab17a05d0947ca0d91537b6e1146c4e8b4fd82e Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 8 Nov 2013 13:03:08 +0100 Subject: [PATCH] don't shift text range if the element has no last child (PY-11344) --- .../inspections/PyUnresolvedReferencesInspection.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) {