Skip to content

Commit

Permalink
patch 8.2.0241: crash when setting 'buftype' to "quickfix"
Browse files Browse the repository at this point in the history
Problem:    Crash when setting 'buftype' to "quickfix".
Solution:   Check that error list is not NULL. (closes vim#5613)
  • Loading branch information
brammool committed Feb 10, 2020
1 parent 408030e commit 99234f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/quickfix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions src/testdir/test_quickfix.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
241,
/**/
240,
/**/
Expand Down

0 comments on commit 99234f2

Please sign in to comment.