From: Bram Moolenaar Date: Mon, 10 Feb 2020 21:56:54 +0000 (+0100) Subject: patch 8.2.0241: crash when setting 'buftype' to "quickfix" X-Git-Tag: v8.2.0241 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=99234f29aa8767f2e71bb1f5db6ee0131bc8e64e;p=vim patch 8.2.0241: crash when setting 'buftype' to "quickfix" Problem: Crash when setting 'buftype' to "quickfix". Solution: Check that error list is not NULL. (closes #5613) --- diff --git a/src/quickfix.c b/src/quickfix.c index 868b5d910..00457e256 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -4520,7 +4520,7 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last) *dirname = NUL; // Add one line for each error - if (old_last == NULL) + if (old_last == NULL || old_last->qf_next == NULL) { qfp = qfl->qf_start; lnum = 0; diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 79ad82d2d..3f4574a12 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -1628,6 +1628,13 @@ func Test_setqflist_invalid_nr() eval []->setqflist(' ', {'nr' : $XXX_DOES_NOT_EXIST}) endfunc +func Test_setqflist_user_sets_buftype() + call setqflist([{'text': 'foo'}, {'text': 'bar'}]) + set buftype=quickfix + call setqflist([], 'a') + enew +endfunc + func Test_quickfix_set_list_with_act() call XquickfixSetListWithAct('c') call XquickfixSetListWithAct('l') diff --git a/src/version.c b/src/version.c index 7eaf24bdd..f9ddda404 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 241, /**/ 240, /**/