* Source/NSLayoutManager.m

(-drawBackgroundForGlyphRange:atPoint:): Make save against
        glyph_run being null. Should fix part of #43454.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38141 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2014-10-31 14:12:44 +00:00
parent d1a934aa44
commit 274b50bbab
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2014-10-31 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSLayoutManager.m
(-drawBackgroundForGlyphRange:atPoint:): Make save against
glyph_run being null. Should fix part of #43454.
2014-10-25 Fred Kiefer <FredKiefer@gmx.de> 2014-10-25 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSParagraphStyle.m, * Source/NSParagraphStyle.m,

View file

@ -1408,12 +1408,14 @@ container
i = range.location - glyph_pos; i = range.location - glyph_pos;
last_color = nil; last_color = nil;
first_char_pos = char_pos; first_char_pos = char_pos;
while (1) while ((glyph_run != nil) && (i + glyph_pos < range.location + range.length))
{ {
NSRange r = NSMakeRange(glyph_pos + i, glyph_run->head.glyph_length - i); NSRange r = NSMakeRange(glyph_pos + i, glyph_run->head.glyph_length - i);
if (NSMaxRange(r) > NSMaxRange(range)) if (NSMaxRange(r) > NSMaxRange(range))
{
r.length = NSMaxRange(range) - r.location; r.length = NSMaxRange(range) - r.location;
}
color = [_textStorage attribute: NSBackgroundColorAttributeName color = [_textStorage attribute: NSBackgroundColorAttributeName
atIndex: char_pos atIndex: char_pos
@ -1446,8 +1448,6 @@ container
char_pos += glyph_run->head.char_length; char_pos += glyph_run->head.char_length;
i = 0; i = 0;
glyph_run = (glyph_run_t *)glyph_run->head.next; glyph_run = (glyph_run_t *)glyph_run->head.next;
if (i + glyph_pos >= range.location + range.length)
break;
} }
if (!_selected_range.length || _selected_range.location == NSNotFound) if (!_selected_range.length || _selected_range.location == NSNotFound)