Skip to content

Commit

Permalink
patch 9.0.0322: crash when no errors and 'quickfixtextfunc' is set
Browse files Browse the repository at this point in the history
Problem:    Crash when no errors and 'quickfixtextfunc' is set.
Solution:   Do not handle errors if there aren't any.
  • Loading branch information
brammool committed Aug 29, 2022
1 parent 37fef16 commit 4f1b083
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/quickfix.c
Expand Up @@ -4761,7 +4761,7 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int qf_winid)
}

// Check if there is anything to display
if (qfl != NULL)
if (qfl != NULL && qfl->qf_start != NULL)
{
char_u dirname[MAXPATHL];
int invalid_val = FALSE;
Expand Down
16 changes: 16 additions & 0 deletions src/testdir/test_quickfix.vim
Expand Up @@ -4107,6 +4107,22 @@ func Xgetlist_empty_tests(cchar)
endif
endfunc

func Test_empty_list_quickfixtextfunc()
" This was crashing. Can only reproduce by running it in a separate Vim
" instance.
let lines =<< trim END
func s:Func(o)
cgetexpr '0'
endfunc
cope
let &quickfixtextfunc = 's:Func'
cgetfile [ex
END
call writefile(lines, 'Xquickfixtextfunc')
call RunVim([], [], '-e -s -S Xquickfixtextfunc -c qa')
call delete('Xquickfixtextfunc')
endfunc

func Test_getqflist()
call Xgetlist_empty_tests('c')
call Xgetlist_empty_tests('l')
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -707,6 +707,8 @@ static char *(features[]) =

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

0 comments on commit 4f1b083

Please sign in to comment.