changeset 16216:6118bd3c9a7c

Fix a printf(%s, NULL) when opening a log for an buddy whose contact has no online buddies and no alias.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 17 Apr 2007 01:38:06 +0000
parents 9d9ddc45c07b
children d5e2db99ac56
files pidgin/gtklog.c
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtklog.c	Mon Apr 16 23:19:38 2007 +0000
+++ b/pidgin/gtklog.c	Tue Apr 17 01:38:06 2007 +0000
@@ -723,15 +723,25 @@
 	}
 	logs = g_list_sort(logs, purple_log_compare);
 
-        pixbuf = gtk_widget_render_icon (image, PIDGIN_STOCK_STATUS_PERSON,
-	                                 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow");
+	pixbuf = gtk_widget_render_icon(image, PIDGIN_STOCK_STATUS_PERSON,
+					gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow");
 	gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf);
-	
+
 	if (contact->alias != NULL)
 		name = contact->alias;
 	else if (contact->priority != NULL)
 		name = purple_buddy_get_contact_alias(contact->priority);
 
+	/* This will happen if the contact doesn't have an alias,
+	 * and none of the contact's buddies are online.
+	 * There is probably a better way to deal with this. */
+	if (name == NULL) {
+		if (contact->node.child != NULL && PURPLE_BLIST_NODE_IS_BUDDY(contact->node.child))
+			name = purple_buddy_get_contact_alias((PurpleBuddy *) contact->node.child);
+		if (name == NULL)
+			name = "";
+	}
+
 	title = g_strdup_printf(_("Conversations with %s"), name);
 	display_log_viewer(ht, logs, title, image, total_log_size);
 	g_free(title);