aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-21 06:47:55 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-05-21 07:05:55 +0800
commitf15ef02a7f3dda6b2f8058efab8407946d1d6a60 (patch)
treee342b650f8c40c34c119a72f7fcf6fad59dc8de6
parent86c9c4d793b3f9eff93fe00ad579427f254c5882 (diff)
downloadgsoc2013-evolution-f15ef02a7f3dda6b2f8058efab8407946d1d6a60.tar
gsoc2013-evolution-f15ef02a7f3dda6b2f8058efab8407946d1d6a60.tar.gz
gsoc2013-evolution-f15ef02a7f3dda6b2f8058efab8407946d1d6a60.tar.bz2
gsoc2013-evolution-f15ef02a7f3dda6b2f8058efab8407946d1d6a60.tar.lz
gsoc2013-evolution-f15ef02a7f3dda6b2f8058efab8407946d1d6a60.tar.xz
gsoc2013-evolution-f15ef02a7f3dda6b2f8058efab8407946d1d6a60.tar.zst
gsoc2013-evolution-f15ef02a7f3dda6b2f8058efab8407946d1d6a60.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 ();