changeset 16663:1c9835f8b29c

A rare crash fix for finch.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 29 Apr 2007 18:03:32 +0000
parents d2809bacb4a0
children 9b41a619d2f7
files finch/gntblist.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntblist.c	Sun Apr 29 15:16:55 2007 +0000
+++ b/finch/gntblist.c	Sun Apr 29 18:03:32 2007 +0000
@@ -1699,8 +1699,17 @@
 
 	newmessage = gnt_entry_get_text(GNT_ENTRY(ggblist->statustext));
 	item = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(ggblist->status));
-	g_return_val_if_fail(item->type == STATUS_PRIMITIVE, FALSE);
-	newprim = item->u.prim;
+
+	switch (item->type) {
+		case STATUS_PRIMITIVE:
+			newprim = item->u.prim;
+			break;
+		case STATUS_SAVED_POPULAR:
+			newprim = purple_savedstatus_get_type(item->u.saved);
+			break;
+		default:
+			goto end;  /* 'New' or 'Saved' is selected, but this should never happen. */
+	}
 
 	if (newprim != prim || ((message && !newmessage) ||
 				(!message && newmessage) ||
@@ -1718,6 +1727,7 @@
 	}
 
 	gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree);
+end:
 	if (ggblist->typing)
 		g_source_remove(ggblist->typing);
 	ggblist->typing = 0;