diff options
-rw-r--r-- | shell/ChangeLog | 6 | ||||
-rw-r--r-- | shell/e-folder-list.c | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index a9be31cf26..1b83ddeecd 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,9 @@ +2003-04-21 Chris Toshok <toshok@ximian.com> + + * e-folder-list.c (e_folder_list_parse_xml): this should never + happen unless you're really trying, but don't crash if the xml + setting is malformed. + 2003-04-21 Ettore Perazzoli <ettore@ximian.com> * e-local-storage.c (create_folder_directory): Don't signal an diff --git a/shell/e-folder-list.c b/shell/e-folder-list.c index 3da34b7c57..fb199be2a9 100644 --- a/shell/e-folder-list.c +++ b/shell/e-folder-list.c @@ -467,13 +467,19 @@ e_folder_list_init (EFolderList *efl) 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; @@ -481,8 +487,6 @@ e_folder_list_parse_xml (const char *xml) return items; } - doc = xmlParseMemory (xml, strlen (xml)); - root = xmlDocGetRootElement (doc); for (node = root->xmlChildrenNode, i = 0; node; node = node->next, i++) |