From 10752c7a830ae7ac3a5ddad9192c3f464a281c4e Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 12 Nov 2001 23:23:51 +0000 Subject: Add a NULL check for rule->name. (mail_vfolder_add_uri): Same here. 2001-11-12 Jeffrey Stedfast * mail-vfolder.c (vfolder_load_storage): Add a NULL check for rule->name. (mail_vfolder_add_uri): Same here. svn path=/trunk/; revision=14677 --- mail/ChangeLog | 6 ++++++ mail/mail-vfolder.c | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 00b15aef6e..8e5da872b7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2001-11-12 Jeffrey Stedfast + + * mail-vfolder.c (vfolder_load_storage): Add a NULL check for + rule->name. + (mail_vfolder_add_uri): Same here. + 2001-11-09 Jeffrey Stedfast * mail-callbacks.c (forward_message): If we already have the diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index c6e0dbac2b..c8788239a5 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -337,20 +337,25 @@ mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) } rule = NULL; - while ( (rule = rule_context_next_rule((RuleContext *)context, rule, NULL)) ) { + while ((rule = rule_context_next_rule((RuleContext *)context, rule, NULL))) { int found = FALSE; - + + if (!rule->name) { + d(printf ("invalid rule (%p): rule->name is set to NULL\n")); + continue; + } + if (rule->source && ((!strcmp(rule->source, "local") && !remote) || (!strcmp(rule->source, "remote_active") && remote) || (!strcmp(rule->source, "local_remote_active")))) found = TRUE; - + /* we check using the store uri_cmp since its more accurate */ source = NULL; - while ( !found && (source = vfolder_rule_next_source((VfolderRule *)rule, source)) ) + while (!found && (source = vfolder_rule_next_source((VfolderRule *)rule, source))) found = uri_cmp(uri, source); - + if (found) { vf = g_hash_table_lookup(vfolder_hash, rule->name); g_assert(vf); @@ -736,7 +741,10 @@ vfolder_load_storage(GNOME_Evolution_Shell shell) /* and setup the rules we have */ rule = NULL; while ( (rule = rule_context_next_rule((RuleContext *)context, rule, NULL)) ) { - context_rule_added((RuleContext *)context, rule); + if (rule->name) + context_rule_added((RuleContext *)context, rule); + else + d(printf ("invalid rule (%p) encountered: rule->name is NULL\n")); } g_free(storeuri); -- cgit