Avoid making calls to the layout manager with invalid arguments.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15748 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-01-28 17:00:28 +00:00
parent f1255d750b
commit 314e298be1

View file

@ -2234,13 +2234,19 @@ This method is for user changes; see NSTextView_actions.m.
NSRange glyphRange;
unsigned glyphIndex;
NSRect rect;
charRange = NSMakeRange (aRange.location, 0);
if (charRange.location == [[[_layoutManager textStorage] string] length])
{
rect = NSZeroRect;
goto ugly_hack_done;
}
charRange = NSMakeRange (aRange.location, 1);
if (charRange.location == [[[_layoutManager textStorage] string] length])
{
if (charRange.location == 0)
{
rect = NSZeroRect;
goto ugly_hack_done;
}
else
charRange.location--;
}
glyphRange = [_layoutManager glyphRangeForCharacterRange: charRange
actualCharacterRange: NULL];
glyphIndex = glyphRange.location;
@ -4052,6 +4058,8 @@ configuation! */
NSRange glyphRange;
NSRect rect;
if (!aRange.length)
return NSZeroRect;
glyphRange = [_layoutManager glyphRangeForCharacterRange: aRange
actualCharacterRange: NULL];
rect = [_layoutManager boundingRectForGlyphRange: glyphRange