summaryrefslogtreecommitdiff
path: root/src/evalbuffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-27 20:57:06 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-27 20:57:06 +0000
commit8dac2acd6a79d571ff5409d9c90b4c9e73237eb4 (patch)
tree1d3712aff207fc834fb5aa8dc5afc2a394fc7788 /src/evalbuffer.c
parent4b28ba3245df8274303c79429972f9dc9438e4aa (diff)
downloadvim-git-8dac2acd6a79d571ff5409d9c90b4c9e73237eb4.tar.gz
patch 8.2.3916: no error for passing an invalid line number to append()v8.2.3916
Problem: No error for passing an invalid line number to append(). Solution: In Vim9 script check for a non-negative number. (closes #9417)
Diffstat (limited to 'src/evalbuffer.c')
-rw-r--r--src/evalbuffer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/evalbuffer.c b/src/evalbuffer.c
index ba16436de..50d26c4b1 100644
--- a/src/evalbuffer.c
+++ b/src/evalbuffer.c
@@ -151,6 +151,8 @@ set_buffer_lines(
if (buf == NULL || (!is_curbuf && buf->b_ml.ml_mfp == NULL) || lnum < 1)
{
rettv->vval.v_number = 1; // FAIL
+ if (in_vim9script() && lnum < 1)
+ semsg(_(e_invalid_line_number_nr), lnum_arg);
return;
}