aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/message.c7
1 files changed, 5 insertions, 2 deletions
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 <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -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;