aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-21 06:47:55 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:17 +0800
commitf0a2397cff81f0f9e14e4087ec91febdc0da0e35 (patch)
tree44889fc0524bba888a9c5d72f002f59370b2d40d
parent53feeabf5d9353e72bd5680e1e07d0b721cc8822 (diff)
downloadgsoc2013-evolution-f0a2397cff81f0f9e14e4087ec91febdc0da0e35.tar
gsoc2013-evolution-f0a2397cff81f0f9e14e4087ec91febdc0da0e35.tar.gz
gsoc2013-evolution-f0a2397cff81f0f9e14e4087ec91febdc0da0e35.tar.bz2
gsoc2013-evolution-f0a2397cff81f0f9e14e4087ec91febdc0da0e35.tar.lz
gsoc2013-evolution-f0a2397cff81f0f9e14e4087ec91febdc0da0e35.tar.xz
gsoc2013-evolution-f0a2397cff81f0f9e14e4087ec91febdc0da0e35.tar.zst
gsoc2013-evolution-f0a2397cff81f0f9e14e4087ec91febdc0da0e35.zip
mail-autofilter.c: Add argument guards in public functions.
This is related to bug #650587, but is not a proper fix. The proper fix is in the next couple commits about EMailReader action groups. This commit just trades a crash for a runtime warning, but can be backported to the stable branch, whereas the changes required for the proper fix are too extensive to backport.
-rw-r--r--mail/mail-autofilter.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index f56135bf60..56cc5e9813 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -319,6 +319,10 @@ em_vfolder_rule_from_message (EMVFolderContext *context,
EMailSession *session;
gchar *uri;
+ g_return_val_if_fail (EM_IS_VFOLDER_CONTEXT (context), NULL);
+ g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (msg), NULL);
+ g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
+
uri = e_mail_folder_uri_from_folder (folder);
session = em_vfolder_context_get_session (context);
@@ -342,6 +346,10 @@ em_vfolder_rule_from_address (EMVFolderContext *context,
EMailSession *session;
gchar *uri;
+ g_return_val_if_fail (EM_IS_VFOLDER_CONTEXT (context), NULL);
+ g_return_val_if_fail (CAMEL_IS_INTERNET_ADDRESS (addr), NULL);
+ g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
+
uri = e_mail_folder_uri_from_folder (folder);
session = em_vfolder_context_get_session (context);
@@ -363,6 +371,9 @@ filter_rule_from_message (EMFilterContext *context,
EFilterRule *rule;
EFilterPart *part;
+ g_return_val_if_fail (EM_IS_FILTER_CONTEXT (context), NULL);
+ g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (msg), NULL);
+
rule = em_filter_rule_new ();
rule_from_message (rule, E_RULE_CONTEXT (context), msg, flags);
@@ -385,7 +396,8 @@ filter_gui_add_from_message (EMailSession *session,
gchar *user, *system;
EFilterRule *rule;
- g_return_if_fail (msg != NULL);
+ g_return_if_fail (E_IS_MAIL_SESSION (session));
+ g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg));
fc = em_filter_context_new (session);
config_dir = mail_session_get_config_dir ();