Patch 8.2.2537
Problem:    Vim9: crash when map() fails.
Solution:   Clear typval before using it. (closes #7884)
Files:      src/list.c, src/testdir/test_vim9_builtin.vim


*** ../vim-8.2.2536/src/list.c  2021-02-20 17:03:57.984112613 +0100
--- src/list.c  2021-02-21 16:00:26.124964080 +0100
***************
*** 2145,2150 ****
--- 2145,2151 ----
                                                           arg_errmsg, TRUE)))
                        break;
                    set_vim_var_string(VV_KEY, di->di_key, -1);
+                   newtv.v_type = VAR_UNKNOWN;
                    r = filter_map_one(&di->di_tv, expr, filtermap,
                                                                 &newtv, &rem);
                    clear_tv(get_vim_var_tv(VV_KEY));
*** ../vim-8.2.2536/src/testdir/test_vim9_builtin.vim   2021-02-10 
22:23:36.398613504 +0100
--- src/testdir/test_vim9_builtin.vim   2021-02-21 16:10:37.638734254 +0100
***************
*** 690,695 ****
--- 690,716 ----
    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
*** ../vim-8.2.2536/src/version.c       2021-02-20 20:26:10.118866290 +0100
--- src/version.c       2021-02-21 16:12:42.606278173 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2537,
  /**/

-- 
In Africa some of the native tribes have a custom of beating the ground
with clubs and uttering spine chilling cries.  Anthropologists call
this a form of primitive self-expression.  In America we call it golf.

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202102211522.11LFM9lb3229310%40masaka.moolenaar.net.

Raspunde prin e-mail lui