To: vim_dev@googlegroups.com Subject: Patch 8.2.1557 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1557 Problem: Crash in :vimgrep when started as "vim -n". (Raul Segura) Solution: Check mfp pointer. (Yegappan Lakshmanan, closes #6827) Files: src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.2.1556/src/quickfix.c 2020-08-07 18:12:14.426099006 +0200 --- src/quickfix.c 2020-08-31 22:14:51.483570104 +0200 *************** *** 6022,6028 **** static int existing_swapfile(buf_T *buf) { ! if (buf->b_ml.ml_mfp != NULL) { char_u *fname = buf->b_ml.ml_mfp->mf_fname; size_t len = STRLEN(fname); --- 6022,6028 ---- static int existing_swapfile(buf_T *buf) { ! 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; size_t len = STRLEN(fname); *** ../vim-8.2.1556/src/testdir/test_quickfix.vim 2020-08-12 18:50:31.883655785 +0200 --- src/testdir/test_quickfix.vim 2020-08-31 22:12:26.112129513 +0200 *************** *** 2833,2838 **** --- 2833,2853 ---- call delete('Xresult') 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') *** ../vim-8.2.1556/src/version.c 2020-08-31 21:58:36.119898707 +0200 --- src/version.c 2020-08-31 22:13:38.951846762 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1557, /**/ -- What the word 'politics' means: 'Poli' in Latin meaning 'many' and 'tics' meaning 'bloodsucking creatures'. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///