changeset 19366:102f9a44c8b3 v8.2.0241

patch 8.2.0241: crash when setting 'buftype' to "quickfix" Commit: https://github.com/vim/vim/commit/99234f29aa8767f2e71bb1f5db6ee0131bc8e64e Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 10 22:56:54 2020 +0100 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 https://github.com/vim/vim/issues/5613)
author Bram Moolenaar <Bram@vim.org>
date Mon, 10 Feb 2020 23:00:04 +0100
parents 91e051377c65
children c2ca0cc9c6e0
files src/quickfix.c src/testdir/test_quickfix.vim src/version.c
diffstat 3 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4520,7 +4520,7 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *bu
 	*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;
--- 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')
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    241,
+/**/
     240,
 /**/
     239,