From 8ce60ddd079450e711e4620fdfa29deb372c0843 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 7 Jul 2022 08:02:41 +0800 Subject: vim-patch:8.2.4399: crash after ml_get error Problem: Crash after ml_get error. Solution: When returning "???" flush the line and set ml_line_lnum. https://github.com/vim/vim/commit/f9435e49ef8032e80d38e31e950e4a9b75387533 --- src/nvim/memline.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 74608e75ad..5f74440747 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -1844,8 +1844,11 @@ char_u *ml_get_buf(buf_T *buf, linenr_T lnum, bool will_change) siemsg(_("E315: ml_get: invalid lnum: %" PRId64), (int64_t)lnum); recursive--; } + ml_flush_line(buf); + buf->b_ml.ml_flags &= ~ML_LINE_DIRTY; errorret: STRCPY(questions, "???"); + buf->b_ml.ml_line_lnum = lnum; return questions; } if (lnum <= 0) { // pretend line 0 is line 1 -- cgit