diff --git a/src/nvim/message.c b/src/nvim/message.c index 58dbee8cf9..0e287268eb 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -12,6 +12,7 @@ #define MESSAGE_FILE /* don't include prototype for smsg() */ +#include #include #include #include @@ -691,8 +692,10 @@ int delete_first_msg(void) return FAIL; p = first_msg_hist; first_msg_hist = p->next; - if (first_msg_hist == NULL) - last_msg_hist = NULL; /* history is empty */ + if (first_msg_hist == NULL) { /* history is becoming empty */ + assert(msg_hist_len == 1); + last_msg_hist = NULL; + } free(p->msg); free(p); --msg_hist_len;