summaryrefslogtreecommitdiffstats
path: root/src/cmdhist.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-25 21:47:45 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-25 21:47:45 +0100
commit8d588ccee57390aa01c2395fc599bbe6506ee13a (patch)
tree327836ed8bfb53b077dba03c311fce8539d067f6 /src/cmdhist.c
parentc593bec4120f122e8a9129ec461968f1bd214435 (diff)
patch 8.2.0316: ex_getln.c code has insufficient test coveragev8.2.0316
Problem: ex_getln.c code has insufficient test coverage. Solution: Add more tests. Fix a problem. (Yegappan Lakshmanan, closes #5693)
Diffstat (limited to 'src/cmdhist.c')
-rw-r--r--src/cmdhist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmdhist.c b/src/cmdhist.c
index 683fc862b8..d708535ff9 100644
--- a/src/cmdhist.c
+++ b/src/cmdhist.c
@@ -389,7 +389,7 @@ calc_hist_idx(int histype, int num)
i += hislen;
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)