[evolution-patches] [Addressbook] Fix for bug 65537



Just don't crash on NULL UIDs.

-- 
Hans Petter
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1822.2.6
diff -u -p -r1.1822.2.6 ChangeLog
--- ChangeLog	23 Sep 2004 20:31:20 -0000	1.1822.2.6
+++ ChangeLog	23 Sep 2004 22:39:10 -0000
@@ -1,3 +1,10 @@
+2004-09-23  Hans Petter Jansson  <hpj ximian com>
+
+	Fixes bug #65537.
+
+	* gui/merging/eab-contact-compare.c (query_cb): Protect against NULL
+	UIDs, and make fewer calls to e_contact_get_const () as a bonus.
+
 2004-09-23  Fazlu & Hannah <hannah_lins yahoo co in>
 
 	Fixes bug #61070
Index: gui/merging/eab-contact-compare.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/merging/eab-contact-compare.c,v
retrieving revision 1.7
diff -u -p -r1.7 eab-contact-compare.c
--- gui/merging/eab-contact-compare.c	26 Jun 2004 01:42:27 -0000	1.7
+++ gui/merging/eab-contact-compare.c	23 Sep 2004 22:39:10 -0000
@@ -613,11 +613,22 @@ query_cb (EBook *book, EBookStatus statu
 	/* remove the contacts we're to avoid from the list, if they're present */
 	for (i = contacts; i != NULL; i = g_list_next (i)) {
 		EContact *this_contact = E_CONTACT (i->data);
+		const gchar *this_uid;
 		GList *iterator;
 		gboolean avoid = FALSE;
+
+		this_uid = e_contact_get_const (this_contact, E_CONTACT_UID);
+		if (!this_uid)
+			continue;
+
 		for (iterator = info->avoid; iterator; iterator = iterator->next) {
-			if (!strcmp (e_contact_get_const (iterator->data, E_CONTACT_UID),
-				     e_contact_get_const (this_contact, E_CONTACT_UID))) {
+			const gchar *avoid_uid;
+
+			avoid_uid = e_contact_get_const (iterator->data, E_CONTACT_UID);
+			if (!avoid_uid)
+				continue;
+
+			if (!strcmp (avoid_uid, this_uid)) {
 				avoid = TRUE;
 				break;
 			}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]