Mercurial > vim
comparison src/evalfunc.c @ 24246:35603c7991d7 v8.2.2664
patch 8.2.2664: Vim9: not enough function arguments checked for string
Commit: https://github.com/vim/vim/commit/32105ae88f3aa6a6af30336f0bc9f8eb81292cd7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 27 18:59:25 2021 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 Mar 2021 19:00:04 +0100 |
parents | c784e176334c |
children | 01b274c3f69b |
comparison
equal
deleted
inserted
replaced
24245:5e22bf689c9f | 24246:35603c7991d7 |
---|---|
2321 post_balloon(balloonEval, NULL, | 2321 post_balloon(balloonEval, NULL, |
2322 l == NULL || l->lv_len == 0 ? NULL : l); | 2322 l == NULL || l->lv_len == 0 ? NULL : l); |
2323 } | 2323 } |
2324 else | 2324 else |
2325 { | 2325 { |
2326 char_u *mesg = tv_get_string_chk(&argvars[0]); | 2326 char_u *mesg; |
2327 | 2327 |
2328 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) | |
2329 return; | |
2330 | |
2331 mesg = tv_get_string_chk(&argvars[0]); | |
2328 if (mesg != NULL) | 2332 if (mesg != NULL) |
2329 // empty string removes the balloon | 2333 // empty string removes the balloon |
2330 post_balloon(balloonEval, *mesg == NUL ? NULL : mesg, NULL); | 2334 post_balloon(balloonEval, *mesg == NUL ? NULL : mesg, NULL); |
2331 } | 2335 } |
2332 } | 2336 } |
2336 static void | 2340 static void |
2337 f_balloon_split(typval_T *argvars, typval_T *rettv UNUSED) | 2341 f_balloon_split(typval_T *argvars, typval_T *rettv UNUSED) |
2338 { | 2342 { |
2339 if (rettv_list_alloc(rettv) == OK) | 2343 if (rettv_list_alloc(rettv) == OK) |
2340 { | 2344 { |
2341 char_u *msg = tv_get_string_chk(&argvars[0]); | 2345 char_u *msg; |
2342 | 2346 |
2347 if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) | |
2348 return; | |
2349 msg = tv_get_string_chk(&argvars[0]); | |
2343 if (msg != NULL) | 2350 if (msg != NULL) |
2344 { | 2351 { |
2345 pumitem_T *array; | 2352 pumitem_T *array; |
2346 int size = split_message(msg, &array); | 2353 int size = split_message(msg, &array); |
2347 int i; | 2354 int i; |