* Fixes NB#81719, modest_tny_account_get_server_account could return NULL, so now...
authorSergio Villar Senin <svillar@igalia.com>
Tue, 4 Mar 2008 17:27:05 +0000 (17:27 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 4 Mar 2008 17:27:05 +0000 (17:27 +0000)
* This fix does not fix the root cause of the bug because it was previously fixed by some other commits (the bug could not be reproduced with the current HEAD)

pmo-trunk-r4272

src/modest-mail-operation.c

index 44fdc7a..51bbb8a 100644 (file)
@@ -1518,6 +1518,24 @@ modest_mail_operation_update_account (ModestMailOperation *self,
                                                             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;