diff src/vim9type.c @ 28952:ba083decce5d v8.2.4998

patch 8.2.4998: Vim9: crash when using multiple funcref() Commit: https://github.com/vim/vim/commit/bce69d65dd41020ea1d727337a3baf9e95b40c35 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 22 13:45:52 2022 +0100 patch 8.2.4998: Vim9: crash when using multiple funcref() Problem: Vim9: crash when using multiple funcref(). Solution: Check if varargs type is NULL. (closes https://github.com/vim/vim/issues/10467)
author Bram Moolenaar <Bram@vim.org>
date Sun, 22 May 2022 15:00:02 +0200
parents c446812efd60
children 49d8b54802f3
line wrap: on
line diff
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -807,7 +807,11 @@ check_argument_types(
 	else
 	    tv = &argvars[i];
 	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 = expected->tt_member;
+	}
 	else
 	    expected = type->tt_args[i];
 	if (check_typval_arg_type(expected, tv, NULL, i + 1) == FAIL)