[evolution-patches] fix for shell/e-folder-list.c crash



If the xml is invalid (only happened to me when i was hand editing the
gconf entry..) we shouldn't crash.

Chris
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1240
diff -u -r1.1240 ChangeLog
--- ChangeLog	16 Apr 2003 14:49:22 -0000	1.1240
+++ ChangeLog	16 Apr 2003 22:41:32 -0000
@@ -1,3 +1,8 @@
+2003-04-16  Chris Toshok  <toshok ximian com>
+
+	* e-folder-list.c (e_folder_list_parse_xml): this should never
+	happen, but don't crash if the xml setting is malformed.
+
 2003-04-16  Ettore Perazzoli  <ettore ximian com>
 
 	* apps_evolution_shell.schemas: Increase the default value for
Index: e-folder-list.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-folder-list.c,v
retrieving revision 1.23
diff -u -r1.23 e-folder-list.c
--- e-folder-list.c	9 Apr 2003 18:02:18 -0000	1.23
+++ e-folder-list.c	16 Apr 2003 22:41:32 -0000
@@ -467,21 +467,25 @@
 EFolderListItem *
 e_folder_list_parse_xml (const char *xml)
 {
-	xmlDoc *doc;
+	xmlDoc *doc = NULL;
 	xmlNode *root;
 	xmlNode *node;
 	int i;
 	EFolderListItem *items;
 
-	if (xml == NULL || *xml == 0) {
+	if (xml && *xml) {
+		doc = xmlParseMemory (xml, strlen (xml));
+		if (!doc)
+			g_warning ("malformed EFolderList xml");
+	}
+
+	if (!doc) {
 		items = g_new (EFolderListItem, 1);
 		items[0].uri = NULL;
 		items[0].physical_uri = NULL;
 		items[0].display_name = NULL;
 		return items;
 	}
-
-	doc = xmlParseMemory (xml, strlen (xml));
 
 	root = xmlDocGetRootElement (doc);
 


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