Inspections - avoid IOOBE on bad range

This commit is contained in:
Alexey Gopachenko
2009-11-10 15:36:35 +03:00
parent 0b8b161c5e
commit 83835aeff4
@@ -132,7 +132,8 @@ public class ProblemDescriptionNode extends InspectionTreeNode {
final TextRange elementRange = psiElement.getTextRange();
if (textRange!=null && elementRange!=null) {
textRange = textRange.shiftRight(-elementRange.getStartOffset());
ref = textRange.substring(ref);
if(textRange.getStartOffset() < 0 && textRange.getEndOffset()<ref.length())
ref = textRange.substring(ref);
}
}
return ref;