From 36818a9daafbcb8e3b06be7b07f52b2d00a61746 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 3 Jan 2023 12:33:26 +0000 Subject: patch 9.0.1138: crash when expecting varargs but it is something else Problem: Crash when expecting varargs but it is something else. Solution: Only use the member when the type is a list. (closes #11774) --- src/vim9instr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/vim9instr.c') 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; -- cgit v1.2.1