diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-03 13:34:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-03 13:34:25 +0800 |
commit | aa492127311692a576d308db3afbd3bba0fead00 (patch) | |
tree | 0c71d0ae6a01ab30c68f57fb7527ce77ed328a1a | |
parent | c0840087c83175267667a355131d4dffccfd8ff5 (diff) | |
download | rneovim-aa492127311692a576d308db3afbd3bba0fead00.tar.gz rneovim-aa492127311692a576d308db3afbd3bba0fead00.tar.bz2 rneovim-aa492127311692a576d308db3afbd3bba0fead00.zip |
vim-patch:9.0.0322: crash when no errors and 'quickfixtextfunc' is set (#21269)
Problem: Crash when no errors and 'quickfixtextfunc' is set.
Solution: Do not handle errors if there aren't any.
https://github.com/vim/vim/commit/4f1b083be43f351bc107541e7b0c9655a5d2c0bb
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | src/nvim/quickfix.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index d4dff746c7..6c13aa5d50 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -4076,7 +4076,7 @@ static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int q } // Check if there is anything to display - if (qfl != NULL) { + if (qfl != NULL && qfl->qf_start != NULL) { char dirname[MAXPATHL]; *dirname = NUL; diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 7b94c4027c..e7a4799e0b 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -3932,6 +3932,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') |