summaryrefslogtreecommitdiff
path: root/src/typval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-03-28 16:26:41 +0200
committerBram Moolenaar <Bram@vim.org>2021-03-28 16:26:41 +0200
commitf6bdd82c7e2076dbacb764a5d288189d61c68451 (patch)
treea69fff2ce77fe6cda576c35cfc104563a4742ee0 /src/typval.c
parentb2ac7d0663ef31a335c50c6afca042ed9ace5059 (diff)
downloadvim-git-f6bdd82c7e2076dbacb764a5d288189d61c68451.tar.gz
patch 8.2.2671: error for line number in legacy scriptv8.2.2671
Problem: Error for line number in legacy script. Solution: Check for number type.
Diffstat (limited to 'src/typval.c')
-rw-r--r--src/typval.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/typval.c b/src/typval.c
index ca561ddbf..cf1208d58 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -1621,11 +1621,12 @@ tv_get_lnum(typval_T *argvars)
if (argvars[0].v_type != VAR_STRING || !in_vim9script())
lnum = (linenr_T)tv_get_number_chk(&argvars[0], NULL);
- if (lnum < 0) // no valid number, try using arg like line()
+ if (lnum <= 0 && argvars[0].v_type != VAR_NUMBER)
{
int fnum;
pos_T *fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE);
+ // no valid number, try using arg like line()
if (fp != NULL)
lnum = fp->lnum;
}