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

patch 8.1.1749: Coverity warns for using negative index

Problem:    Coverity warns for using negative index.
Solution:   Move using index inside "if".
This commit is contained in:
Bram Moolenaar
2019-07-25 21:58:19 +02:00
parent 74da39373c
commit 736cd2cfbe
2 changed files with 3 additions and 1 deletions

View File

@@ -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),