From 2ab70ea439d3b0001d1d01e1e79d07bc4bb99d41 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Fri, 3 Oct 2003 09:19:36 +0000 Subject: Check for failed load of the toolbars model from the XML file, and fix the 2003-10-03 Christian Persch * lib/egg/egg-toolbars-model.c: (safe_save_xml), (egg_toolbars_model_load): Check for failed load of the toolbars model from the XML file, and fix the check for failed save of same to the XML file. --- lib/egg/egg-toolbars-model.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c index fc74aa174..091604087 100755 --- a/lib/egg/egg-toolbars-model.c +++ b/lib/egg/egg-toolbars-model.c @@ -146,7 +146,7 @@ safe_save_xml (const char *xml_file, xmlDocPtr doc) tmp_file = g_strconcat (xml_file, ".tmp", NULL); old_file = g_strconcat (xml_file, ".old", NULL); - if (!xmlSaveFormatFile (tmp_file, doc, 1)) + if (xmlSaveFormatFile (tmp_file, doc, 1) <= 0) { g_warning ("Failed to write XML data to %s", tmp_file); goto failed; @@ -441,6 +441,11 @@ egg_toolbars_model_load (EggToolbarsModel *t, g_return_if_fail (IS_EGG_TOOLBARS_MODEL (t)); doc = xmlParseFile (xml_file); + if (doc == NULL) + { + g_warning ("Failed to load XML data from %s", xml_file); + return; + } root = xmlDocGetRootElement (doc); t->priv->toolbars = g_node_new (NULL); -- cgit v1.2.3