diff src/vim9execute.c @ 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 f7f2d73ff85e
children 48feb3dd0d25
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -2607,6 +2607,8 @@ call_def_function(
 		    tv = STACK_TV_BOT(-1);
 		    // no need to check for VAR_STRING, 2STRING will check.
 		    key = tv->vval.v_string;
+		    if (key == NULL)
+			key = (char_u *)"";
 
 		    if ((di = dict_find(dict, key, -1)) == NULL)
 		    {