Mercurial > vim
diff src/testdir/test_listdict.vim @ 21064:6dc8625889fe v8.2.1083
patch 8.2.1083: crash when using reduce() on a NULL list
Commit: https://github.com/vim/vim/commit/fda20c4cc59008264676a6deb6a3095ed0c248e0
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 29 20:09:36 2020 +0200
patch 8.2.1083: crash when using reduce() on a NULL list
Problem: Crash when using reduce() on a NULL list.
Solution: Only access the list when not NULL.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 29 Jun 2020 20:15:04 +0200 |
parents | 3b29ac3394dc |
children | 6a4806e326dd |
line wrap: on
line diff
--- a/src/testdir/test_listdict.vim +++ b/src/testdir/test_listdict.vim @@ -718,6 +718,9 @@ func Test_reduce() call assert_fails("call reduce(g:lut, { acc, val -> EvilRemove() }, 1)", 'E742:') unlet g:lut delfunc EvilRemove + + call assert_equal(42, reduce(test_null_list(), function('add'), 42)) + call assert_equal(42, reduce(test_null_blob(), function('add'), 42)) endfunc " splitting a string to a List using split()