summaryrefslogtreecommitdiff
path: root/src/viminfo.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-25 21:58:19 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-25 21:58:19 +0200
commit736cd2cfbe83b85259eecc7d70e68297ce968d33 (patch)
treed3418d5dae8e633db4faa3b20dd749350e10cdd3 /src/viminfo.c
parent74da39373c90fcb390068903b5bbb93ce7ac16fa (diff)
downloadvim-git-736cd2cfbe83b85259eecc7d70e68297ce968d33.tar.gz
patch 8.1.1749: Coverity warns for using negative indexv8.1.1749
Problem: Coverity warns for using negative index. Solution: Move using index inside "if".
Diffstat (limited to 'src/viminfo.c')
-rw-r--r--src/viminfo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/viminfo.c b/src/viminfo.c
index cd3bbb65c..1b09414be 100644
--- a/src/viminfo.c
+++ b/src/viminfo.c
@@ -1420,9 +1420,9 @@ read_viminfo_search_pattern(vir_T *virp, int force)
else if (lp[0] == 'H') // ~H: 'hlsearch' highlighting on
hlsearch_on = TRUE;
#endif
- spat = get_spat(idx);
if (idx >= 0)
{
+ spat = get_spat(idx);
if (force || spat->pat == NULL)
{
val = viminfo_readstring(virp, (int)(lp - virp->vir_line + 1),