mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
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
This commit is contained in:
parent
1c71c32b29
commit
3d8f0cb695
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user