patch 8.2.3206: Vim9: argument types are not checked at compile time
Problem: Vim9: argument types are not checked at compile time.
Solution: Add several more type checks. (Yegappan Lakshmanan, closes #8611)
diff --git a/src/cmdhist.c b/src/cmdhist.c
index dee95ba..f3b8b00 100644
--- a/src/cmdhist.c
+++ b/src/cmdhist.c
@@ -570,6 +570,11 @@
char_u buf[NUMBUFLEN];
char_u *str;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || check_for_opt_string_or_number_arg(argvars, 1) == FAIL))
+ return;
+
str = tv_get_string_chk(&argvars[0]); // NULL on type error
if (str == NULL)
n = 0;