From 6e28ab6523e9b07a724f8b5499aa9123bc51a772 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 17 Mar 2008 12:55:53 +0000 Subject: ** Fix for bug #514744 2008-03-17 Milan Crha ** Fix for bug #514744 * em-folder-tree-model.c: (em_folder_tree_model_load_state): Check also for proper root node and use default if not the right one. svn path=/trunk/; revision=35209 --- mail/ChangeLog | 7 +++++++ mail/em-folder-tree-model.c | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 85cd57d9e5..185ac5d149 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2008-03-17 Milan Crha + + ** Fix for bug #514744 + + * em-folder-tree-model.c: (em_folder_tree_model_load_state): + Check also for proper root node and use default if not the right one. + 2008-03-13 Milan Crha * em-folder-tree.c: diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 7d174e8fbc..b0a5206d7f 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -339,8 +339,14 @@ em_folder_tree_model_load_state (EMFolderTreeModel *model, const char *filename) if (model->state) xmlFreeDoc (model->state); - if ((model->state = e_xml_parse_file (filename))) - return; + if ((model->state = e_xml_parse_file (filename)) != NULL) { + node = xmlDocGetRootElement (model->state); + if (!node || strcmp ((char *)node->name, "tree-state") != 0) { + /* it is not expected XML file, thus free it and use the default */ + xmlFreeDoc (model->state); + } else + return; + } /* setup some defaults - expand "Local Folders" and "Search Folders" */ model->state = xmlNewDoc ((const unsigned char *)"1.0"); -- cgit