diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-06-21 19:44:11 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-06-21 19:44:11 +0200 |
commit | 035bd1c99f2a8eda5ee886adde4f97ea71fb167f (patch) | |
tree | 8f666e256d60b0d5d490ada1074743ff975fa75a /src/ex_docmd.c | |
parent | f1e7449d567c630601aa0cec6c663b791785a668 (diff) |
patch 8.2.3029: Vim9: crash when using operator and list unpack assignmentv8.2.3029
Problem: Vim9: crash when using operator and list unpack assignment.
(Naohiro Ono)
Solution: Get variable value before operation. (closes #8416)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 2a9983f8a8..027d139da4 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -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; |