diff --git a/Source/GSSimpleLayoutManager.m b/Source/GSSimpleLayoutManager.m index aa95775ac..67145e18a 100644 --- a/Source/GSSimpleLayoutManager.m +++ b/Source/GSSimpleLayoutManager.m @@ -431,7 +431,14 @@ static NSCharacterSet *invSelectionWordGranularitySet; if (effectiveRange) *effectiveRange = NSMakeRange(0, [_textStorage length]); - return [_textContainers objectAtIndex: 0]; + if ([_textContainers count] == 0) + { + return nil; + } + else + { + return [_textContainers objectAtIndex: 0]; + } } - (void) setTextContainer: (NSTextContainer*)aTextContainer