aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 1d75eb93..6bd6f315 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -760,9 +760,10 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
lineNumber++;
}
}
-
+
// Safety-check the line number
if (lineNumber > [lineRanges count]) lineNumber = [lineRanges count];
+ if (lineNumber < 1) lineNumber = 1;
// Grab the range to select
selRange = NSRangeFromString([lineRanges objectAtIndex:lineNumber-1]);