diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-10-09 13:58:55 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-09 13:58:55 +0100 |
commit | 35a319b77f897744eec1155b736e9372c9c5575f (patch) | |
tree | 29e9f66577a2daa83cb75b80754ca52dca3bedb9 /src/ex_docmd.c | |
parent | 26190b27011c25caedf3b9308e47005722b3f946 (diff) | |
download | vim-git-35a319b77f897744eec1155b736e9372c9c5575f.tar.gz |
patch 8.2.3489: ml_get error after search with rangev8.2.3489
Problem: ml_get error after search with range.
Solution: Limit the line number to the buffer line count.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 2c55e67bc..08a48305e 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -4229,8 +4229,10 @@ get_address( // When '/' or '?' follows another address, start from // there. - if (lnum != MAXLNUM) - curwin->w_cursor.lnum = lnum; + if (lnum > 0 && lnum != MAXLNUM) + curwin->w_cursor.lnum = + lnum > curbuf->b_ml.ml_line_count + ? curbuf->b_ml.ml_line_count : lnum; // Start a forward search at the end of the line (unless // before the first line). |