From: Richard Russon Date: Tue, 23 Oct 2018 22:25:15 +0000 (+0100) Subject: Imap: tidy X-Git-Tag: 2019-10-25~593^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b91d18658e3e07cce124f69d4c7f8b2542aa584;p=neomutt Imap: tidy --- diff --git a/imap/command.c b/imap/command.c index acf929245..2f484d7b9 100644 --- a/imap/command.c +++ b/imap/command.c @@ -1086,6 +1086,9 @@ int imap_cmd_start(struct ImapAccountData *adata, const char *cmdstr) */ int imap_cmd_step(struct ImapAccountData *adata) { + if (!adata) + return -1; + size_t len = 0; int c; int rc; @@ -1313,6 +1316,9 @@ int imap_exec(struct ImapAccountData *adata, const char *cmdstr, int flags) */ void imap_cmd_finish(struct ImapAccountData *adata) { + if (!adata) + return; + if (adata->status == IMAP_FATAL) { cmd_handle_fatal(adata); diff --git a/imap/imap.c b/imap/imap.c index 04cae3170..467581e48 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -948,9 +948,9 @@ struct ImapAccountData *imap_conn_find(const struct ConnAccount *account, int fl else if (adata->state < IMAP_AUTHENTICATED) continue; } - if (flags & MUTT_IMAP_CONN_NOSELECT && adata && adata->state >= IMAP_SELECTED) + if ((flags & MUTT_IMAP_CONN_NOSELECT) && adata && (adata->state >= IMAP_SELECTED)) continue; - if (adata && adata->status == IMAP_FATAL) + if (adata && (adata->status == IMAP_FATAL)) continue; break; } @@ -981,7 +981,7 @@ struct ImapAccountData *imap_conn_find(const struct ConnAccount *account, int fl else mutt_account_unsetpass(&adata->conn->account); } - if (new && adata->state == IMAP_AUTHENTICATED) + if (new && (adata->state == IMAP_AUTHENTICATED)) { /* capabilities may have changed */ imap_exec(adata, "CAPABILITY", IMAP_CMD_QUEUE); @@ -1384,6 +1384,9 @@ int imap_check_mailbox(struct Mailbox *mailbox, bool force) */ int imap_check(struct ImapAccountData *adata, bool force) { + if (!adata) + return -1; + /* overload keyboard timeout to avoid many mailbox checks in a row. * Most users don't like having to wait exactly when they press a key. */ int result = 0; @@ -1488,7 +1491,7 @@ int imap_mailbox_check(bool check_stats) continue; } - if (lastdata && adata != lastdata) + if (lastdata && (adata != lastdata)) { /* Send commands to previous server. Sorting the mailbox list * may prevent some infelicitous interleavings */