changeset 32394:3ea785e1cc22

Rearrange code to prevent a NULL-deference. Thanks to clh for pointing out this issue. Closes #14392.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 22 Dec 2011 01:13:20 +0000
parents 490ad537b77f
children 152661e41e7f
files pidgin/gtkconv.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Thu Dec 22 00:50:40 2011 +0000
+++ b/pidgin/gtkconv.c	Thu Dec 22 01:13:20 2011 +0000
@@ -6624,7 +6624,15 @@
 	if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
 		return;
 
+	if ((tag = get_buddy_tag(conv, old_name, 0, FALSE)))
+		g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL);
+	if ((tag = get_buddy_tag(conv, old_name, PURPLE_MESSAGE_NICK, FALSE)))
+		g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL);
+
 	old_cbuddy = purple_conv_chat_cb_find(chat, old_name);
+	if (!old_cbuddy)
+		return;
+
 	if (get_iter_from_chatbuddy(old_cbuddy, &iter)) {
 		GtkTreeRowReference *ref = purple_conv_chat_cb_get_ui_data(old_cbuddy);
 
@@ -6633,14 +6641,6 @@
 		purple_conv_chat_cb_set_ui_data(old_cbuddy, NULL);
 	}
 
-	if ((tag = get_buddy_tag(conv, old_name, 0, FALSE)))
-		g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL);
-	if ((tag = get_buddy_tag(conv, old_name, PURPLE_MESSAGE_NICK, FALSE)))
-		g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL);
-
-	if (!old_cbuddy)
-		return;
-
 	g_return_if_fail(new_alias != NULL);
 
 	new_cbuddy = purple_conv_chat_cb_find(chat, new_name);