Fixes NB#78683
authorFelipe Erias Morandeira <femorandeira@igalia.com>
Tue, 18 Dec 2007 14:29:08 +0000 (14:29 +0000)
committerFelipe Erias Morandeira <femorandeira@igalia.com>
Tue, 18 Dec 2007 14:29:08 +0000 (14:29 +0000)
 * 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
src/modest-mail-operation.c
src/modest-tny-send-queue.c

index 3de0e3a..89a71a4 100644 (file)
@@ -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;
index 961d5d4..688399d 100644 (file)
@@ -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);
index bd1f2e9..0c8b199 100644 (file)
@@ -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);