aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvoidiz <29259387+voidiz@users.noreply.github.com>2023-11-08 02:23:13 +0100
committerGitHub <noreply@github.com>2023-11-08 09:23:13 +0800
commit3d8f0cb695a5ea97ea05bc7decb19bb047cb753d (patch)
tree20e294e461957e83f650e83ff414df020eadce79
parent1c71c32b29100b3e2989447da9d94b97b2c9959e (diff)
downloadrneovim-3d8f0cb695a5ea97ea05bc7decb19bb047cb753d.tar.gz
rneovim-3d8f0cb695a5ea97ea05bc7decb19bb047cb753d.tar.bz2
rneovim-3d8f0cb695a5ea97ea05bc7decb19bb047cb753d.zip
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
-rw-r--r--src/nvim/quickfix.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 2e3cc4f170..61157301b6 100644
--- 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;
+ }
}
}