Check that item->fileinfo is not NULL, before trying to use a string

2004-07-15  Rodney Dawes  <dobey@novell.com>

	* gnome-wp-item.c (gnome_wp_item_new):
	Check that item->fileinfo is not NULL, before trying to use a
	string variable inside the struct for a strncmp

	Fixes #147373
This commit is contained in:
Rodney Dawes 2004-07-15 13:58:51 +00:00 committed by Rodney Dawes
parent 2207580efa
commit 64837f243f
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2004-07-15 Rodney Dawes <dobey@novell.com>
* gnome-wp-item.c (gnome_wp_item_new):
Check that item->fileinfo is not NULL, before trying to use a
string variable inside the struct for a strncmp
Fixes #147373
2004-06-28 Rodney Dawes <dobey@novell.com>
* *.[ch]: Update copyright info to have correct years (2003-2004)

View file

@ -53,7 +53,8 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
item->pcolor = gdk_color_copy (&color1);
item->scolor = gdk_color_copy (&color2);
if (!strncmp (item->fileinfo->mime_type, "image/", strlen ("image/"))) {
if (item->fileinfo != NULL &&
!strncmp (item->fileinfo->mime_type, "image/", strlen ("image/"))) {
if (item->name == NULL) {
item->name = g_strdup (item->fileinfo->name);
}