summaryrefslogtreecommitdiff
path: root/src/vim9instr.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-01-03 12:33:26 +0000
committerBram Moolenaar <Bram@vim.org>2023-01-03 12:33:26 +0000
commit36818a9daafbcb8e3b06be7b07f52b2d00a61746 (patch)
tree36946401734f25b5a814e2b1d83b3f68587c8cee /src/vim9instr.c
parentea720aea851e645f4c8ec3b20afb27c7ca38184c (diff)
downloadvim-git-36818a9daafbcb8e3b06be7b07f52b2d00a61746.tar.gz
patch 9.0.1138: crash when expecting varargs but it is something elsev9.0.1138
Problem: Crash when expecting varargs but it is something else. Solution: Only use the member when the type is a list. (closes #11774)
Diffstat (limited to 'src/vim9instr.c')
-rw-r--r--src/vim9instr.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vim9instr.c b/src/vim9instr.c
index bd2c1b414..72ecbaa65 100644
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -1841,7 +1841,13 @@ check_func_args_from_type(
type_T *expected;
if (varargs && i >= type->tt_argcount - 1)
- expected = type->tt_args[type->tt_argcount - 1]->tt_member;
+ {
+ expected = type->tt_args[type->tt_argcount - 1];
+ if (expected != NULL && expected->tt_type == VAR_LIST)
+ expected = expected->tt_member;
+ if (expected == NULL)
+ expected = &t_any;
+ }
else if (i >= type->tt_min_argcount
&& actual->tt_type == VAR_SPECIAL)
expected = &t_any;