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

patch 8.2.3916: no error for passing an invalid line number to append()

Problem:    No error for passing an invalid line number to append().
Solution:   In Vim9 script check for a non-negative number. (closes #9417)
This commit is contained in:
Bram Moolenaar
2021-12-27 20:57:06 +00:00
parent 4b28ba3245
commit 8dac2acd6a
7 changed files with 31 additions and 8 deletions

View File

@@ -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;
}