imap_allow_reopen(ctx);
rc = imap_check(ctx->mailbox->data, false);
+ /* NOTE - ctx might have been changed at this point. In particular,
+ * ctx->mailbox could be NULL. Beware. */
imap_disallow_reopen(ctx);
return rc;
void imap_disallow_reopen(struct Context *ctx)
{
struct ImapMboxData *mdata = NULL;
- if (!ctx || !ctx->mailbox->data || ctx->mailbox->magic != MUTT_IMAP)
+ if (!ctx || !ctx->mailbox || !ctx->mailbox->data || ctx->mailbox->magic != MUTT_IMAP)
return;
mdata = ctx->mailbox->data;