From: Bram Moolenaar Date: Sat, 8 Feb 2020 15:00:46 +0000 (+0100) Subject: patch 8.2.0232: the :compiler command causes a crash X-Git-Tag: v8.2.0232 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=165315584d6587e287f54d6c8820e050114b5694;p=vim patch 8.2.0232: the :compiler command causes a crash Problem: The :compiler command causes a crash. (Daniel Steinberg) Solution: Do not use the script index if it isn't set. --- diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 645ad0c93..659af1911 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2495,7 +2495,8 @@ do_one_cmd( #ifdef FEAT_EVAL // Set flag that any command was executed, used by ex_vim9script(). - if (getline_equal(ea.getline, ea.cookie, getsourceline)) + if (getline_equal(ea.getline, ea.cookie, getsourceline) + && current_sctx.sc_sid > 0) SCRIPT_ITEM(current_sctx.sc_sid)->sn_had_command = TRUE; /* diff --git a/src/testdir/test_compiler.vim b/src/testdir/test_compiler.vim index 4f02cf1c2..464dd9bcb 100644 --- a/src/testdir/test_compiler.vim +++ b/src/testdir/test_compiler.vim @@ -1,6 +1,7 @@ " Test the :compiler command source check.vim +source shared.vim func Test_compiler() if !executable('perl') @@ -48,6 +49,15 @@ func Test_compiler_without_arg() call assert_match(runtime .. '/compiler/xmlwf.vim$', a[-1]) endfunc +" Test executing :compiler from the command line, not from a script +func Test_compiler_commandline() + call system(GetVimCommandClean() .. ' --not-a-term -c "compiler gcc" -c "call writefile([b:current_compiler], ''XcompilerOut'')" -c "quit"') + call assert_equal(0, v:shell_error) + call assert_equal(["gcc"], readfile('XcompilerOut')) + + call delete('XcompilerOut') +endfunc + func Test_compiler_completion() call feedkeys(":compiler \\\"\", 'tx') call assert_match('^"compiler ant bcc .* xmlwf$', @:) diff --git a/src/version.c b/src/version.c index db1f9f77b..e1fde105f 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 232, /**/ 231, /**/