[evolution-ews] Be more resilient to calendar items without our X-EVOLUTION-ITEMID fields



commit b8573956f408ff2f29008e19ef32b592c99e97ea
Author: David Woodhouse <David Woodhouse intel com>
Date:   Mon Aug 1 21:21:30 2011 +0100

    Be more resilient to calendar items without our X-EVOLUTION-ITEMID fields

 src/calendar/e-cal-backend-ews.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index fecfcb1..2a6fbb2 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -633,10 +633,20 @@ add_comps_to_item_id_hash (ECalBackendEws *cbews)
 	comps = e_cal_backend_store_get_components (priv->store);
 	for (l = comps; l != NULL; l = g_slist_next (l)) {
 		ECalComponent *comp = (ECalComponent *)	l->data;
-		gchar *item_id;
+		gchar *item_id = NULL;
 
 		ews_cal_component_get_item_id (comp, &item_id, NULL);
-
+		if (!item_id) {
+			const gchar *uid;
+
+			/* This should never happen, but sometimes when our
+			   use of X- fields has changed it has triggered. Make
+			   it cope, and not crash */
+			e_cal_component_get_uid(comp, &uid);
+			g_warning ("EWS calendar item %s had no EWS ItemID!",
+				   uid);
+			continue;
+		}
 		g_hash_table_insert (priv->item_id_hash, item_id, comp);
 	}
 



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