0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2036: buffer messed up if creating the quickfix window fails

Problem:    Current buffer is messed up if creating a new buffer for the
            quickfix window fails.
Solution:   Check that creating the buffer succeeds. (closes #7352)
This commit is contained in:
Bram Moolenaar
2020-11-23 20:15:08 +01:00
parent f637bceb61
commit 9e40c4b15e
4 changed files with 55 additions and 3 deletions

View File

@@ -4151,13 +4151,15 @@ qf_open_new_cwindow(qf_info_T *qi, int height)
if (qf_buf != NULL)
{
// Use the existing quickfix buffer
(void)do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE,
ECMD_HIDE + ECMD_OLDBUF, oldwin);
if (do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE,
ECMD_HIDE + ECMD_OLDBUF, oldwin) == FAIL)
return FAIL;
}
else
{
// Create a new quickfix buffer
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin);
if (do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin) == FAIL)
return FAIL;
// save the number of the new buffer
qi->qf_bufnr = curbuf->b_fnum;