aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Williams <peterw@src.gnome.org>2000-07-01 00:37:55 +0800
committerPeter Williams <peterw@src.gnome.org>2000-07-01 00:37:55 +0800
commitac6baa408e751313bdba2672d522b0ae7f38477d (patch)
treef47759dc0e8c9970d88b6f2a1eb44928d68e1131
parent767f92d2b8ed11176f0eb83e239c443c5536ee81 (diff)
downloadgsoc2013-evolution-ac6baa408e751313bdba2672d522b0ae7f38477d.tar.gz
gsoc2013-evolution-ac6baa408e751313bdba2672d522b0ae7f38477d.tar.zst
gsoc2013-evolution-ac6baa408e751313bdba2672d522b0ae7f38477d.zip
Add some checks for bad/nonexistant XML docs.
svn path=/trunk/; revision=3828
-rw-r--r--filter/ChangeLog9
-rw-r--r--filter/filter-driver.c6
-rw-r--r--filter/filter-editor.c11
-rw-r--r--filter/filter-xml.c4
4 files changed, 27 insertions, 3 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 6bcf2bd0a4..89dbfa465b 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,12 @@
+2000-06-30 Peter Williams <peterw@curious-george.helixcode.com>
+
+ * filter-xml.c (filter_load_optionset_file): Check for failure
+ when loading the filter doc.
+
+ * filter-driver.c (filter_driver_set_rules): Ditto.
+
+ * filter-editor.c (filter_editor_set_rule_files): Ditto.
+
2000-06-29 Ettore Perazzoli <ettore@helixcode.com>
* filter-arg-types.c: Replaced `global_shell_interface' with
diff --git a/filter/filter-driver.c b/filter/filter-driver.c
index 92d337f958..357469ee3c 100644
--- a/filter/filter-driver.c
+++ b/filter/filter-driver.c
@@ -206,7 +206,11 @@ int filter_driver_set_rules(FilterDriver *d, const char *description, const char
p->rules = filter_load_ruleset(desc);
filt = xmlParseFile(filter);
- p->options = filter_load_optionset(filt, p->rules);
+ if( filt == NULL ) {
+ g_warning( "Couldn't load filter file %s!", filter );
+ p->options = NULL;
+ } else
+ p->options = filter_load_optionset(filt, p->rules);
#warning "Zucchi: is this safe? Doesn't seem to cause problems..."
filter_load_ruleset_free (p->rules);
diff --git a/filter/filter-editor.c b/filter/filter-editor.c
index bd039db21b..61ec13732c 100644
--- a/filter/filter-editor.c
+++ b/filter/filter-editor.c
@@ -370,8 +370,15 @@ filter_editor_set_rule_files(FilterEditor *e, const char *systemrules, const cha
xmlDocPtr doc, out, optionset, filteroptions;
doc = xmlParseFile(systemrules);
- rules = filter_load_ruleset(doc);
- options2 = filter_load_optionset(doc, rules);
+ if( doc == NULL ) {
+ g_warning( "Couldn't load system rules file %s", systemrules );
+ rules = NULL;
+ options2 = NULL;
+ } else {
+ rules = filter_load_ruleset(doc);
+ options2 = filter_load_optionset(doc, rules);
+ }
+
out = xmlParseFile(userrules);
if (out)
options = filter_load_optionset(out, rules);
diff --git a/filter/filter-xml.c b/filter/filter-xml.c
index dc8271ae7e..ca95112127 100644
--- a/filter/filter-xml.c
+++ b/filter/filter-xml.c
@@ -555,6 +555,10 @@ GList *filter_load_optionset_file(const char *name, GList *rules)
GList *options;
doc = xmlParseFile(name);
+ if( doc == NULL ) {
+ g_warning( "Couldn't load option file %s!", name );
+ return NULL;
+ }
options = filter_load_optionset(doc, rules);
xmlFreeDoc(doc);