BTextView::SetFontAndColor() no longer crashes with a NULL font pointer.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16560 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-03-01 17:39:08 +00:00
parent 383638eee9
commit 5891e232e2
+14 -11
View File
@@ -1512,25 +1512,28 @@ BTextView::SetFontAndColor(const BFont *inFont, uint32 inMode, const rgb_color *
void
BTextView::SetFontAndColor(int32 startOffset, int32 endOffset, const BFont *inFont,
uint32 inMode, const rgb_color *inColor)
BTextView::SetFontAndColor(int32 startOffset, int32 endOffset, const BFont* font,
uint32 fontMode, const rgb_color* color)
{
CALLED();
BFont newFont = *inFont;
NormalizeFont(&newFont);
BFont newFont;
if (font != NULL) {
newFont = font;
NormalizeFont(&newFont);
}
// add the style to the style buffer
fStyles->SetStyleRange(startOffset, endOffset, fText->Length(),
inMode, &newFont, inColor);
if (inMode & B_FONT_FAMILY_AND_STYLE || inMode & B_FONT_SIZE)
fontMode, &newFont, color);
if (fontMode & B_FONT_FAMILY_AND_STYLE || fontMode & B_FONT_SIZE) {
// recalc the line breaks and redraw with new style
Refresh(startOffset, endOffset, startOffset != endOffset, false);
else
} else {
// the line breaks wont change, simply redraw
DrawLines(LineAt(startOffset), LineAt(endOffset), startOffset, true);
}
}