0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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)
This commit is contained in:
Bram Moolenaar
2022-03-10 20:47:43 +00:00
parent 1b1df95f1a
commit e406ff87c8
3 changed files with 21 additions and 1 deletions

View File

@@ -1622,7 +1622,10 @@ lookup_debug_var(char_u *name)
// Go through the local variable names, from last to first.
for (idx = debug_var_count - 1; idx >= 0; --idx)
{
if (STRCMP(((char_u **)dfunc->df_var_names.ga_data)[idx], name) == 0)
char_u *varname = ((char_u **)dfunc->df_var_names.ga_data)[idx];
// the variable name may be NULL when not available in this block
if (varname != NULL && STRCMP(varname, name) == 0)
return STACK_TV_VAR(idx);
}