Don't crash if the text string is NULL. (text_draw_with_objects): Don't

2001-12-10  Jon Trowbridge  <trow@ximian.com>

        * gal/e-text/e-text.c (text_width_with_objects): Don't crash if
        the text string is NULL.
        (text_draw_with_objects): Don't crash if the text string is NULL.
        (Fixes #16359)

svn path=/trunk/; revision=14954
This commit is contained in:
Jon Trowbridge
2001-12-10 17:50:14 +00:00
committed by Jon Trowbridge
parent edf6873ade
commit 5f447101dd

View File

@ -897,7 +897,7 @@ text_width_with_objects (ETextModel *model,
EFont *font, EFontStyle style,
const gchar *text, gint numbytes)
{
return e_font_utf8_text_width (font, style, text, numbytes);
return text && *text ? e_font_utf8_text_width (font, style, text, numbytes) : 0;
}
static void
@ -909,6 +909,9 @@ text_draw_with_objects (ETextModel *model,
const gchar *text, gint numbytes)
{
const gchar *c;
if (text == NULL)
return;
while (*text && numbytes > 0) {
gint obj_num = -1;