don't call strlen on a NULL font name.

2007-07-20  Sven Neumann  <sven@gimp.org>

	* app/text/gimptext.c (gimp_text_set_property): don't call strlen
	on a NULL font name.

svn path=/trunk/; revision=22968
This commit is contained in:
Sven Neumann
2007-07-20 15:10:24 +00:00
committed by Sven Neumann
parent e2b9c20b43
commit 46eb9b2f90
2 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2007-07-20 Sven Neumann <sven@gimp.org>
* app/text/gimptext.c (gimp_text_set_property): don't call strlen
on a NULL font name.
2007-07-20 Sven Neumann <sven@gimp.org>
* app/tools/gimprectangletool.c: fixed a gtk-doc comment.

View File

@ -364,13 +364,22 @@ gimp_text_set_property (GObject *object,
case PROP_FONT:
{
const gchar *font = g_value_get_string (value);
gsize len = strlen (font);
if (g_str_has_suffix (font, " Not-Rotated"))
len -= strlen ( " Not-Rotated");
g_free (text->font);
text->font = g_strndup (font, len);
if (font)
{
gsize len = strlen (font);
if (g_str_has_suffix (font, " Not-Rotated"))
len -= strlen ( " Not-Rotated");
text->font = g_strndup (font, len);
}
else
{
text->font = NULL;
}
}
break;
case PROP_FONT_SIZE: