From a2e8a6b6bbbfeaf6d51c43182d2c629c1d98bbcb Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 26 Aug 2019 13:08:58 +0100 Subject: [PATCH] sidebar: fix crash with no mailbox --- sidebar.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; -- 2.40.0