changeset 17502:bc6088919610 v8.1.1749

patch 8.1.1749: Coverity warns for using negative index commit https://github.com/vim/vim/commit/736cd2cfbe83b85259eecc7d70e68297ce968d33 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 25 21:58:19 2019 +0200 patch 8.1.1749: Coverity warns for using negative index Problem: Coverity warns for using negative index. Solution: Move using index inside "if".
author Bram Moolenaar <Bram@vim.org>
date Thu, 25 Jul 2019 22:00:05 +0200
parents ee0183fdf5f8
children 638669fc0f65
files src/version.c src/viminfo.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1749,
+/**/
     1748,
 /**/
     1747,
--- a/src/viminfo.c
+++ b/src/viminfo.c
@@ -1420,9 +1420,9 @@ read_viminfo_search_pattern(vir_T *virp,
     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),