mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
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 #6827)
This commit is contained in:
@@ -6022,7 +6022,7 @@ vgr_process_args(
|
|||||||
static int
|
static int
|
||||||
existing_swapfile(buf_T *buf)
|
existing_swapfile(buf_T *buf)
|
||||||
{
|
{
|
||||||
if (buf->b_ml.ml_mfp != NULL)
|
if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL)
|
||||||
{
|
{
|
||||||
char_u *fname = buf->b_ml.ml_mfp->mf_fname;
|
char_u *fname = buf->b_ml.ml_mfp->mf_fname;
|
||||||
size_t len = STRLEN(fname);
|
size_t len = STRLEN(fname);
|
||||||
|
@@ -2833,6 +2833,21 @@ func Test_vimgrep_with_no_last_search_pat()
|
|||||||
call delete('Xresult')
|
call delete('Xresult')
|
||||||
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')
|
||||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1557,
|
||||||
/**/
|
/**/
|
||||||
1556,
|
1556,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user