aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-02 09:40:06 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-02 11:57:53 +0800
commit727754377281aa442767c0ad9c25fec7dd2533ab (patch)
tree8c6da1a08e4bb88f876e93bb6fc6d24461cff93e /src/nvim/ex_getln.c
parentd197e77a55586efff17a555fa92a01a4fad784af (diff)
downloadrneovim-727754377281aa442767c0ad9c25fec7dd2533ab.tar.gz
rneovim-727754377281aa442767c0ad9c25fec7dd2533ab.tar.bz2
rneovim-727754377281aa442767c0ad9c25fec7dd2533ab.zip
vim-patch:8.2.0316: ex_getln.c code has insufficient test coverage
Problem: ex_getln.c code has insufficient test coverage. Solution: Add more tests. Fix a problem. (Yegappan Lakshmanan, closes vim/vim#5693) https://github.com/vim/vim/commit/8d588ccee57390aa01c2395fc599bbe6506ee13a
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 49f946d6c0..1982b2dace 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -6293,7 +6293,7 @@ static int calc_hist_idx(int histype, int num)
wrapped = TRUE;
}
}
- if (hist[i].hisnum == num && hist[i].hisstr != NULL) {
+ if (i >= 0 && hist[i].hisnum == num && hist[i].hisstr != NULL) {
return i;
}
} else if (-num <= hislen) {