summaryrefslogtreecommitdiffstats
path: root/src/sound.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-07-24 21:33:26 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-24 21:33:26 +0200
commit5bca906b307728fa74a112914dc55b424d512d39 (patch)
tree46c144eecea8b23bf66138a46029afa6f275bf85 /src/sound.c
parent7d60384a00755e5c0112cebeb5e232fc133c9eca (diff)
patch 8.2.3215: Vim9: argument types are not checked at compile timev8.2.3215
Problem: Vim9: argument types are not checked at compile time. Solution: Add several more type checks. Sort the argument lists. (Yegappan Lakshmanan, closes #8626)
Diffstat (limited to 'src/sound.c')
-rw-r--r--src/sound.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sound.c b/src/sound.c
index 702fd257a7..f857c87255 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -179,6 +179,9 @@ invoke_sound_callback(void)
static void
sound_play_common(typval_T *argvars, typval_T *rettv, int playfile)
{
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
if (context == NULL)
ca_context_create(&context);
if (context != NULL)
@@ -351,6 +354,9 @@ f_sound_playevent(typval_T *argvars, typval_T *rettv)
{
WCHAR *wp;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
wp = enc_to_utf16(tv_get_string(&argvars[0]), NULL);
if (wp == NULL)
return;
@@ -371,6 +377,9 @@ f_sound_playfile(typval_T *argvars, typval_T *rettv)
char buf[32];
MCIERROR err;
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
esc = vim_strsave_shellescape(tv_get_string(&argvars[0]), FALSE, FALSE);
len = STRLEN(esc) + 5 + 18 + 1;