diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-10-17 11:05:33 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-10-17 11:09:35 -0400 |
commit | b9fe30cac2967a4f7bc29d32a3cf1196fa3a1f3a (patch) | |
tree | a5fc7392ee76a62d00437e010e036a09342b8e9a /src | |
parent | afd4888c6ae0430cb9e9b26a4b43734b7f39610f (diff) | |
download | rneovim-b9fe30cac2967a4f7bc29d32a3cf1196fa3a1f3a.tar.gz rneovim-b9fe30cac2967a4f7bc29d32a3cf1196fa3a1f3a.tar.bz2 rneovim-b9fe30cac2967a4f7bc29d32a3cf1196fa3a1f3a.zip |
vim-patch:8.2.1557: crash in :vimgrep when started as "vim -n"
Problem: Crash in :vimgrep when started as "vim -n". (Raul Segura)
Solution: Check mfp pointer. (Yegappan Lakshmanan, closes vim/vim#6827)
https://github.com/vim/vim/commit/997cd1a17f030d004b334d17cf1c1c57050c9906
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/quickfix.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 9352d5e8cc..4d3d0f5fdf 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -5073,7 +5073,7 @@ static void vgr_jump_to_match(qf_info_T *qi, int forceit, int *redraw_for_dummy, static bool existing_swapfile(const buf_T *buf) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { - if (buf->b_ml.ml_mfp != NULL) { + if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL) { const char_u *const fname = buf->b_ml.ml_mfp->mf_fname; const size_t len = STRLEN(fname); diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 1124032966..d46233991c 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -1,8 +1,7 @@ " Test for the quickfix commands. -if !has('quickfix') - finish -endif +source check.vim +CheckFeature quickfix set encoding=utf-8 @@ -2568,6 +2567,21 @@ func Test_vimgrep_incsearch() set noincsearch endfunc +" Test vimgrep without swap file +func Test_vimgrep_without_swap_file() + let lines =<< trim [SCRIPT] + vimgrep grep test_c* + call writefile(['done'], 'Xresult') + qall! + [SCRIPT] + call writefile(lines, 'Xscript') + if RunVim([], [], '--clean -n -S Xscript Xscript') + call assert_equal(['done'], readfile('Xresult')) + endif + call delete('Xscript') + call delete('Xresult') +endfunc + func Test_vimgrep_existing_swapfile() call writefile(['match apple with apple'], 'Xapple') call writefile(['swapfile'], '.Xapple.swp') |