0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.3029: Vim9: crash when using operator and list unpack assignment

Problem:    Vim9: crash when using operator and list unpack assignment.
            (Naohiro Ono)
Solution:   Get variable value before operation. (closes #8416)
This commit is contained in:
Bram Moolenaar
2021-06-21 19:44:11 +02:00
parent f1e7449d56
commit 035bd1c99f
7 changed files with 96 additions and 20 deletions

View File

@@ -3485,6 +3485,8 @@ find_ex_command(
// can't be an assignment.
if (*eap->cmd == '[')
{
char_u *eq;
p = to_name_const_end(eap->cmd);
if (p == eap->cmd && *p == '[')
{
@@ -3493,12 +3495,19 @@ find_ex_command(
p = skip_var_list(eap->cmd, TRUE, &count, &semicolon, TRUE);
}
if (p == NULL || p == eap->cmd || *skipwhite(p) != '=')
eq = p;
if (eq != NULL)
{
eq = skipwhite(eq);
if (vim_strchr((char_u *)"+-*/%", *eq) != NULL)
++eq;
}
if (p == NULL || p == eap->cmd || *eq != '=')
{
eap->cmdidx = CMD_eval;
return eap->cmd;
}
if (p > eap->cmd && *skipwhite(p) == '=')
if (p > eap->cmd && *eq == '=')
{
eap->cmdidx = CMD_var;
return eap->cmd;