retrieve_limit = G_MAXINT;
/* Get per-account retrieval type */
- retrieve_type = modest_account_mgr_get_retrieve_type (mgr, info->account_name);
+ retrieve_type = modest_account_mgr_get_retrieve_type (mgr, info->account_name);
headers_only = (retrieve_type == MODEST_ACCOUNT_RETRIEVE_HEADERS_ONLY);
/* Order by date */
}
if (num_messages != 0) {
- /* Send mails */
- g_object_unref (priv->account);
-
/* Reenable suspended items */
modest_tny_send_queue_wakeup (MODEST_TNY_SEND_QUEUE (send_queue));
account_name,
TNY_ACCOUNT_TYPE_STORE);
+ /* The above function could return NULL */
+ if (!priv->account) {
+ /* Check if the operation was a success */
+ g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
+ MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND,
+ "no account");
+ priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
+
+ /* Call the user callback */
+ if (callback)
+ callback (self, NULL, user_data);
+
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
+
+ return;
+ }
+
/* Create the helper object */
info = g_slice_new0 (UpdateAccountInfo);
info->pending_calls = 1;