neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 3d8f0cb695a5ea97ea05bc7decb19bb047cb753d
parent 1c71c32b29100b3e2989447da9d94b97b2c9959e
Author: voidiz <29259387+voidiz@users.noreply.github.com>
Date:   Wed,  8 Nov 2023 02:23:13 +0100

fix(diagnostic): check if delete failed in `qf_fill_buffer()` (#25932)

When the contents of a quickfix buffer are replaced, there is a chance
that deletion of the previous lines fails. This ensures that we don't
get stuck in an infinite loop of retrying.

Fix #25402
Diffstat:
Msrc/nvim/quickfix.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c @@ -4135,7 +4135,12 @@ static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int q // delete all existing lines while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0) { - (void)ml_delete((linenr_T)1, false); + // If deletion fails, this loop may run forever, so + // signal error and return. + if (ml_delete((linenr_T)1, false) == FAIL) { + internal_error("qf_fill_buffer()"); + return; + } } }