]> granicus.if.org Git - vim/commitdiff
patch 8.2.0241: crash when setting 'buftype' to "quickfix" v8.2.0241
authorBram Moolenaar <Bram@vim.org>
Mon, 10 Feb 2020 21:56:54 +0000 (22:56 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 10 Feb 2020 21:56:54 +0000 (22:56 +0100)
Problem:    Crash when setting 'buftype' to "quickfix".
Solution:   Check that error list is not NULL. (closes #5613)

src/quickfix.c
src/testdir/test_quickfix.vim
src/version.c

index 868b5d910a3df541469bf4bc96e2190c38d6b372..00457e256d3681aa74943d726b98c167edd59130 100644 (file)
@@ -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;
index 79ad82d2d6fcd9adf20ee987f636db574d888319..3f4574a1290a93880e498dc9d5bbfa10ce85e7b6 100644 (file)
@@ -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')
index 7eaf24bdd1994ccc4836f1f9d7c96970b5097917..f9ddda4044cf02ebb5bcb9d8cc78fdb73697c775 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    241,
 /**/
     240,
 /**/