diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-02-21 16:20:18 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-02-21 16:20:18 +0100 |
commit | 027c4ab4d2e3ff031b98e0fb648f5acbea180293 (patch) | |
tree | b0eac633e8d09f20cd8014a26e80dc429b366a5d /src/testdir | |
parent | dc167465f87a4f03f9e085597dfcfdde39fcd2b9 (diff) |
patch 8.2.2537: Vim9: crash when map() failsv8.2.2537
Problem: Vim9: crash when map() fails.
Solution: Clear typval before using it. (closes #7884)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index cb36990657..3ee8a620f6 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -690,6 +690,27 @@ def Test_maparg_mapset() nunmap <F3> enddef +def Test_map_failure() + CheckFeature job + + var lines =<< trim END + vim9script + writefile([], 'Xtmpfile') + silent e Xtmpfile + var d = {[bufnr('%')]: {a: 0}} + au BufReadPost * Func() + def Func() + if d->has_key('') + endif + eval d[expand('<abuf>')]->mapnew((_, v: dict<job>) => 0) + enddef + e + END + CheckScriptFailure(lines, 'E1013:') + au! BufReadPost + delete('Xtmpfile') +enddef + def Test_max() g:flag = true var l1: list<number> = g:flag |