[evolution] mail-autofilter.c: Add argument guards in public functions.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] mail-autofilter.c: Add argument guards in public functions.
- Date: Fri, 20 May 2011 23:26:56 +0000 (UTC)
commit f15ef02a7f3dda6b2f8058efab8407946d1d6a60
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri May 20 18:47:55 2011 -0400
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.
mail/mail-autofilter.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index f56135b..56cc5e9 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 ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]