Mercurial > vim
changeset 22752:84fca115b1bb v8.2.1924
patch 8.2.1924: Vim9: crash when indexing dict with NULL key
Commit: https://github.com/vim/vim/commit/086fc9a585afa4317046fa0a36c7b896286e5128
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Oct 30 18:33:02 2020 +0100
patch 8.2.1924: Vim9: crash when indexing dict with NULL key
Problem: Vim9: crash when indexing dict with NULL key.
Solution: Use empty string instead of NULL. (closes https://github.com/vim/vim/issues/7229) Make error
message more useful for empty string.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 30 Oct 2020 18:45:04 +0100 |
parents | f9f8ec2acdea |
children | de60f3ec1ffa |
files | src/globals.h src/testdir/test_vim9_expr.vim src/version.c src/vim9execute.c |
diffstat | 4 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/globals.h +++ b/src/globals.h @@ -1699,7 +1699,7 @@ EXTERN char e_invalblob[] INIT(= N_("E97 EXTERN char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s")); EXTERN char e_toofewarg[] INIT(= N_("E119: Not enough arguments for function: %s")); EXTERN char e_func_deleted[] INIT(= N_("E933: Function was deleted: %s")); -EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: %s")); +EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: \"%s\"")); EXTERN char e_listreq[] INIT(= N_("E714: List required")); EXTERN char e_listblobreq[] INIT(= N_("E897: List or Blob required")); EXTERN char e_list_end[] INIT(= N_("E697: Missing end of List ']': %s"));
--- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -1917,6 +1917,7 @@ def Test_expr7_dict() CheckDefExecFailure(['var x: dict<string> = #{a: "x", b: 134}'], 'E1012:', 1) CheckDefFailure(['var x = ({'], 'E723:', 2) + CheckDefExecFailure(['{}[getftype("")]'], 'E716: Key not present in Dictionary: ""', 1) enddef def Test_expr7_dict_vim9script()