0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.2664: Vim9: not enough function arguments checked for string

Problem:    Vim9: not enough function arguments checked for string.
Solution:   Check in balloon functions.  Refactor function arguments.
This commit is contained in:
Bram Moolenaar
2021-03-27 18:59:25 +01:00
parent 79efa2e3b3
commit 32105ae88f
7 changed files with 58 additions and 29 deletions

View File

@@ -2323,8 +2323,12 @@ f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED)
}
else
{
char_u *mesg = tv_get_string_chk(&argvars[0]);
char_u *mesg;
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
return;
mesg = tv_get_string_chk(&argvars[0]);
if (mesg != NULL)
// empty string removes the balloon
post_balloon(balloonEval, *mesg == NUL ? NULL : mesg, NULL);
@@ -2338,8 +2342,11 @@ f_balloon_split(typval_T *argvars, typval_T *rettv UNUSED)
{
if (rettv_list_alloc(rettv) == OK)
{
char_u *msg = tv_get_string_chk(&argvars[0]);
char_u *msg;
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
return;
msg = tv_get_string_chk(&argvars[0]);
if (msg != NULL)
{
pumitem_T *array;