Rocco Rutte:
[apps/madmutt.git] / imap / imap.c
index adebf53..76d9f8b 100644 (file)
@@ -1017,7 +1017,7 @@ int imap_sync_mailbox (CONTEXT * ctx, int expunge, int *index_hint)
       /* if the message has been rethreaded or attachments have been deleted
        * we delete the message and reupload it.
        * This works better if we're expunging, of course. */
-      if (ctx->hdrs[n]->refs_changed || ctx->hdrs[n]->irt_changed ||
+      if ((ctx->hdrs[n]->env && (ctx->hdrs[n]->env->refs_changed || ctx->hdrs[n]->env->irt_changed)) ||
           ctx->hdrs[n]->attach_del) {
         debug_print (3, ("Attachments to be deleted, falling back to _mutt_save_message\n"));
         if (!appendctx)
@@ -1046,7 +1046,7 @@ int imap_sync_mailbox (CONTEXT * ctx, int expunge, int *index_hint)
     idata->reopen |= IMAP_EXPUNGE_EXPECTED;
     if (imap_exec (idata, "EXPUNGE", 0) != 0) {
       imap_error (_("imap_sync_mailbox: EXPUNGE failed"), idata->cmd.buf);
-      rc = -1;
+      rc = imap_reconnect (ctx);
       goto out;
     }
   }