summaryrefslogtreecommitdiffstats
path: root/src/cmdhist.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-07-15 12:49:58 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-15 12:49:58 +0200
commit1a71d31bf34b0b2b08517903826004ec6fd440e5 (patch)
tree05f54a00199737fe81fdf49e9ea72c09dba483d9 /src/cmdhist.c
parentc816a2c22667108fcd61f445de2c926f78ff9fa7 (diff)
patch 8.2.3162: Vim9: argument types are not checked at compile timev8.2.3162
Problem: Vim9: argument types are not checked at compile time. Solution: Add more type checks. (Yegappan Lakshmanan, closes #8560)
Diffstat (limited to 'src/cmdhist.c')
-rw-r--r--src/cmdhist.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmdhist.c b/src/cmdhist.c
index 8bb3cb61c7..1b04e62237 100644
--- a/src/cmdhist.c
+++ b/src/cmdhist.c
@@ -597,6 +597,12 @@ f_histget(typval_T *argvars UNUSED, typval_T *rettv)
int idx;
char_u *str;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || (argvars[1].v_type != VAR_UNKNOWN
+ && check_for_number_arg(argvars, 1) == FAIL)))
+ return;
+
str = tv_get_string_chk(&argvars[0]); // NULL on type error
if (str == NULL)
rettv->vval.v_string = NULL;