0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1751: using 2 where bool is expected may throw an error

Problem:    Using 2 where bool is expected may throw an error.
Solution:   Make this backwards compatible.
This commit is contained in:
Bram Moolenaar
2020-09-26 22:39:24 +02:00
parent 3697c9bbae
commit bade44e5ca
5 changed files with 10 additions and 5 deletions

View File

@@ -177,7 +177,7 @@ tv_get_bool_or_number_chk(typval_T *varp, int *denote, int want_bool)
switch (varp->v_type)
{
case VAR_NUMBER:
if (want_bool && varp->vval.v_number != 0
if (in_vim9script() && want_bool && varp->vval.v_number != 0
&& varp->vval.v_number != 1)
{
semsg(_(e_using_number_as_bool_nr), varp->vval.v_number);