EA-33335 - NPE: MoveRenameUsageInfo.init
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Wed, 1 Feb 2012 07:26:14 +0000 (11:26 +0400)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Wed, 1 Feb 2012 07:59:38 +0000 (11:59 +0400)
platform/lang-api/src/com/intellij/refactoring/util/MoveRenameUsageInfo.java

index 3fe5bf17858caa626b11f0bd41a6e64492a97782..3413475fa4776a1f51a1f767c514cf5a7af40a0b 100644 (file)
  */
 package com.intellij.refactoring.util;
 
-import com.intellij.psi.*;
-import com.intellij.usageView.UsageInfo;
-import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.*;
+import com.intellij.usageView.UsageInfo;
 import org.jetbrains.annotations.Nullable;
 
 public class MoveRenameUsageInfo extends UsageInfo{
@@ -53,7 +53,12 @@ public class MoveRenameUsageInfo extends UsageInfo{
     }
     if (reference == null) reference = element.getReference();
     PsiFile containingFile = element.getContainingFile();
-    if (reference == null) reference = containingFile.findReferenceAt(element.getTextRange().getStartOffset());
+    if (reference == null) {
+      final TextRange textRange = element.getTextRange();
+      if (textRange != null) {
+        reference = containingFile.findReferenceAt(textRange.getStartOffset());
+      }
+    }
     myReference = reference;
     if (reference != null) {
       Document document = PsiDocumentManager.getInstance(project).getDocument(containingFile);