comparison src/vim9execute.c @ 28033:73f4d1e479f2 v8.2.4541

patch 8.2.4541: Crash in debugger when a variable is not available Commit: https://github.com/vim/vim/commit/e406ff87c86de9da2d02d0e5ebbbf5c5eac051a6 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 10 20:47:43 2022 +0000 patch 8.2.4541: Crash in debugger when a variable is not available Problem: Crash in debugger when a variable is not available in the current block. Solution: Check for a NULL name. (closes #9926)
author Bram Moolenaar <Bram@vim.org>
date Thu, 10 Mar 2022 22:00:04 +0100
parents 53e2bf6032e5
children 632a84e2ce92
comparison
equal deleted inserted replaced
28032:8b90d89c9bdd 28033:73f4d1e479f2
1620 dfunc = ((dfunc_T *)def_functions.ga_data) + ectx->ec_dfunc_idx; 1620 dfunc = ((dfunc_T *)def_functions.ga_data) + ectx->ec_dfunc_idx;
1621 1621
1622 // Go through the local variable names, from last to first. 1622 // Go through the local variable names, from last to first.
1623 for (idx = debug_var_count - 1; idx >= 0; --idx) 1623 for (idx = debug_var_count - 1; idx >= 0; --idx)
1624 { 1624 {
1625 if (STRCMP(((char_u **)dfunc->df_var_names.ga_data)[idx], name) == 0) 1625 char_u *varname = ((char_u **)dfunc->df_var_names.ga_data)[idx];
1626
1627 // the variable name may be NULL when not available in this block
1628 if (varname != NULL && STRCMP(varname, name) == 0)
1626 return STACK_TV_VAR(idx); 1629 return STACK_TV_VAR(idx);
1627 } 1630 }
1628 1631
1629 // Go through argument names. 1632 // Go through argument names.
1630 ufunc = dfunc->df_ufunc; 1633 ufunc = dfunc->df_ufunc;