changeset 14143:11394a70de37

[gaim-migrate @ 16785] Fix some assertion failures committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 16 Aug 2006 07:02:26 +0000
parents 89d043d547cc
children 92f5e6f3acfb
files src/gtkstatusbox.c src/prefs.c
diffstat 2 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkstatusbox.c	Wed Aug 16 06:58:59 2006 +0000
+++ b/src/gtkstatusbox.c	Wed Aug 16 07:02:26 2006 +0000
@@ -1179,7 +1179,9 @@
 	icon_alc.x = allocation->width - icon_alc.width;
 	icon_alc.y += 3;
 
-	if (status_box->icon_size != icon_alc.height) {
+	if ((status_box->buddy_icon_path != NULL) &&
+		(status_box->icon_size != icon_alc.height))
+	{
 		scaled = gdk_pixbuf_new_from_file_at_scale(status_box->buddy_icon_path,
 							   icon_alc.height, icon_alc.width, FALSE, NULL);
 		status_box->buddy_icon_hover = gdk_pixbuf_copy(scaled);
@@ -1335,13 +1337,16 @@
 	g_free(box->buddy_icon_path);
 	box->buddy_icon_path = g_strdup(filename);
 
-	scaled = gdk_pixbuf_new_from_file_at_scale(filename,
-						   box->icon_size, box->icon_size, FALSE, NULL);
-	box->buddy_icon_hover = gdk_pixbuf_copy(scaled);
-	do_colorshift(box->buddy_icon_hover, box->buddy_icon_hover, 30);
-	g_object_unref(box->buddy_icon);
-	box->buddy_icon = scaled;
-	gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon);
+	if (filename != NULL)
+	{
+		scaled = gdk_pixbuf_new_from_file_at_scale(filename,
+							   box->icon_size, box->icon_size, FALSE, NULL);
+		box->buddy_icon_hover = gdk_pixbuf_copy(scaled);
+		do_colorshift(box->buddy_icon_hover, box->buddy_icon_hover, 30);
+		g_object_unref(box->buddy_icon);
+		box->buddy_icon = scaled;
+		gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon);
+	}
 
 	gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename);
 }
--- a/src/prefs.c	Wed Aug 16 06:58:59 2006 +0000
+++ b/src/prefs.c	Wed Aug 16 07:02:26 2006 +0000
@@ -124,14 +124,14 @@
 	}
 	else if (pref->type == GAIM_PREF_STRING) {
 		xmlnode_set_attrib(node, "type", "string");
-		xmlnode_set_attrib(node, "value", pref->value.string);
+		xmlnode_set_attrib(node, "value", pref->value.string ? pref->value.string : "");
 	}
 	else if (pref->type == GAIM_PREF_STRING_LIST) {
 		xmlnode_set_attrib(node, "type", "stringlist");
 		for (cur = pref->value.stringlist; cur != NULL; cur = cur->next)
 		{
 			childnode = xmlnode_new_child(node, "item");
-			xmlnode_set_attrib(childnode, "value", cur->data);
+			xmlnode_set_attrib(childnode, "value", cur->data ? cur->data : "");
 		}
 	}
 	else if (pref->type == GAIM_PREF_BOOLEAN) {