From e5a5278df98df3dccee506b0847644055fb11905 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Mon, 21 Apr 2003 22:15:36 +0000 Subject: this should never happen unless you're really trying, but don't crash if 2003-04-21 Chris Toshok * 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. svn path=/trunk/; revision=20912 --- shell/e-folder-list.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'shell/e-folder-list.c') 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++) -- cgit v1.2.3