From: Richard Russon Date: Thu, 27 Dec 2018 11:13:32 +0000 (+0000) Subject: pager: prevent negative index X-Git-Tag: 2019-10-25~415 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee8449720c6c73359a99b30e75a2f57fd63d8f74;p=neomutt pager: prevent negative index --- diff --git a/pager.c b/pager.c index 32182beae..557ad72e3 100644 --- a/pager.c +++ b/pager.c @@ -2391,7 +2391,7 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e /* After the mailbox has been updated, * rd.index->current might be invalid */ rd.index->current = - MIN(rd.index->current, (Context->mailbox->msg_count - 1)); + MIN(rd.index->current, MAX(Context->mailbox->msg_count - 1, 0)); index_hint = Context->mailbox ->emails[Context->mailbox->v2r[rd.index->current]] ->index;