mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 12:38:33 +00:00
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)
997cd1a17f
This commit is contained in:
@@ -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)
|
static bool existing_swapfile(const buf_T *buf)
|
||||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
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 char_u *const fname = buf->b_ml.ml_mfp->mf_fname;
|
||||||
const size_t len = STRLEN(fname);
|
const size_t len = STRLEN(fname);
|
||||||
|
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
" Test for the quickfix commands.
|
" Test for the quickfix commands.
|
||||||
|
|
||||||
if !has('quickfix')
|
source check.vim
|
||||||
finish
|
CheckFeature quickfix
|
||||||
endif
|
|
||||||
|
|
||||||
set encoding=utf-8
|
set encoding=utf-8
|
||||||
|
|
||||||
@@ -2568,6 +2567,21 @@ func Test_vimgrep_incsearch()
|
|||||||
set noincsearch
|
set noincsearch
|
||||||
endfunc
|
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()
|
func Test_vimgrep_existing_swapfile()
|
||||||
call writefile(['match apple with apple'], 'Xapple')
|
call writefile(['match apple with apple'], 'Xapple')
|
||||||
call writefile(['swapfile'], '.Xapple.swp')
|
call writefile(['swapfile'], '.Xapple.swp')
|
||||||
|
Reference in New Issue
Block a user