From a8422818a74b56ab42a92cbf3c044165657a4060 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 21 Oct 2018 22:07:47 +0200 Subject: [PATCH] fix warning: null pointer dereference Found by clang scan-build 5.0 --- src/nvim/message.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/nvim/message.c b/src/nvim/message.c index 1778e0048f..5dafde5bd1 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1475,11 +1475,13 @@ void msg_prt_line(char_u *s, int list) while (!got_int) { if (n_extra > 0) { - --n_extra; - if (c_extra) + n_extra--; + if (c_extra) { c = c_extra; - else + } else { + assert(p_extra != NULL); c = *p_extra++; + } } else if ((l = utfc_ptr2len(s)) > 1) { col += utf_ptr2cells(s); char buf[MB_MAXBYTES + 1];