From: Richard Russon Date: Mon, 26 Aug 2019 12:08:58 +0000 (+0100) Subject: sidebar: fix crash with no mailbox X-Git-Tag: 2019-10-25~77 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a2e8a6b6bbbfeaf6d51c43182d2c629c1d98bbcb;p=neomutt sidebar: fix crash with no mailbox --- diff --git a/sidebar.c b/sidebar.c index 6e6fad096..fb7f66f6c 100644 --- a/sidebar.c +++ b/sidebar.c @@ -127,7 +127,8 @@ static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int if (!m) return src; - bool c = Context && (mutt_str_strcmp(Context->mailbox->realpath, m->realpath) == 0); + bool c = Context && Context->mailbox && + (mutt_str_strcmp(Context->mailbox->realpath, m->realpath) == 0); optional = flags & MUTT_FORMAT_OPTIONAL; @@ -863,7 +864,7 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) col = div_width; mutt_window_move(MuttSidebarWindow, row, col); - if (Context && (Context->mailbox->realpath[0] != '\0') && + if (Context && Context->mailbox && (Context->mailbox->realpath[0] != '\0') && (mutt_str_strcmp(m->realpath, Context->mailbox->realpath) == 0)) { m->msg_unread = Context->mailbox->msg_unread;