From 9f4ac039eb47915ec367a05d893c871a077c9390 Mon Sep 17 00:00:00 2001 From: Felipe Erias Morandeira Date: Tue, 18 Dec 2007 14:29:08 +0000 Subject: [PATCH] Fixes NB#78683 * Adds checks for NULL values from modest_tny_send_queue_get_outbox() and modest_tny_account_get_special_folder() * Also, removes three dummy g_warning() in modest-msg-edit-window.c pmo-trunk-r3935 --- src/maemo/modest-msg-edit-window.c | 3 --- src/modest-mail-operation.c | 10 ++++++++++ src/modest-tny-send-queue.c | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index 3de0e3a..89a71a4 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -1709,15 +1709,12 @@ text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *windo { case GTK_JUSTIFY_LEFT: action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentLeftMenu"); - g_warning ("GTK_JUSTIFY_LEFT"); break; case GTK_JUSTIFY_CENTER: action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentCenterMenu"); - g_warning ("GTK_JUSTIFY_CENTER"); break; case GTK_JUSTIFY_RIGHT: action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentRightMenu"); - g_warning ("GTK_JUSTIFY_RIGHT"); break; default: break; diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index 961d5d4..688399d 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -872,8 +872,16 @@ modest_mail_operation_send_new_mail_cb (ModestMailOperation *self, /* Remove old mail from its source folder */ draft_folder = modest_tny_account_get_special_folder (TNY_ACCOUNT (info->transport_account), TNY_FOLDER_TYPE_DRAFTS); + if (!draft_folder) { + g_warning ("%s: modest_tny_account_get_special_folder(..) returned a NULL drafts folder", __FUNCTION__); + goto end; + } outbox_folder = modest_tny_account_get_special_folder (TNY_ACCOUNT (info->transport_account), TNY_FOLDER_TYPE_OUTBOX); + if (!outbox_folder) { + g_warning ("%s: modest_tny_account_get_special_folder(..) returned a NULL outbox folder", __FUNCTION__); + goto end; + } if (info->draft_msg != NULL) { TnyFolder *folder = NULL; TnyFolder *src_folder = NULL; @@ -1775,6 +1783,8 @@ modest_mail_operation_remove_folder (ModestMailOperation *self, TNY_FOLDER_STORE (trash_folder), TRUE, NULL, NULL); g_object_unref (trash_folder); + } else { + g_warning ("%s: modest_tny_account_get_special_folder(..) returned a NULL trash folder", __FUNCTION__); } } else { TnyFolderStore *parent = tny_folder_get_folder_store (folder); diff --git a/src/modest-tny-send-queue.c b/src/modest-tny-send-queue.c index bd1f2e9..0c8b199 100644 --- a/src/modest-tny-send-queue.c +++ b/src/modest-tny-send-queue.c @@ -159,6 +159,10 @@ modest_tny_send_queue_cancel (TnySendQueue *self, gboolean remove, GError **err) /* Set flags to supend sending operaiton (if removed, this is not necessary) */ if (!remove) { outbox = modest_tny_send_queue_get_outbox (TNY_SEND_QUEUE(self)); + if (!outbox) { + g_warning ("%s: modest_tny_send_queue_get_outbox(..) returned NULL\n", __FUNCTION__); + goto frees; + } tny_folder_get_headers (outbox, headers, TRUE, err); if (err != NULL) goto frees; iter = tny_list_create_iterator (headers); -- 1.7.9.5