comparison 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
comparison
equal deleted inserted replaced
22751:f9f8ec2acdea 22752:84fca115b1bb
2605 dict = tv->vval.v_dict; 2605 dict = tv->vval.v_dict;
2606 2606
2607 tv = STACK_TV_BOT(-1); 2607 tv = STACK_TV_BOT(-1);
2608 // no need to check for VAR_STRING, 2STRING will check. 2608 // no need to check for VAR_STRING, 2STRING will check.
2609 key = tv->vval.v_string; 2609 key = tv->vval.v_string;
2610 if (key == NULL)
2611 key = (char_u *)"";
2610 2612
2611 if ((di = dict_find(dict, key, -1)) == NULL) 2613 if ((di = dict_find(dict, key, -1)) == NULL)
2612 { 2614 {
2613 SOURCING_LNUM = iptr->isn_lnum; 2615 SOURCING_LNUM = iptr->isn_lnum;
2614 semsg(_(e_dictkey), key); 2616 semsg(_(e_dictkey), key);