Minor, fix exception: do not try to get line start offset for line < 0 and line == lineCount()

This commit is contained in:
Natalia Ukhorskaya
2016-02-11 14:06:03 +03:00
parent 657459ef22
commit 7fb1848bd5
@@ -292,7 +292,7 @@ class SelectionAwareScopeHighlighter(val editor: Editor) {
fun PsiFile.getLineStartOffset(line: Int): Int? {
val doc = PsiDocumentManager.getInstance(project).getDocument(this)
if (doc != null && line <= doc.lineCount) {
if (doc != null && line >= 0 && line < doc.lineCount) {
val startOffset = doc.getLineStartOffset(line)
val element = findElementAt(startOffset) ?: return startOffset