patch 8.1.1749: Coverity warns for using negative index

Problem:    Coverity warns for using negative index.
Solution:   Move using index inside "if".
diff --git a/src/viminfo.c b/src/viminfo.c
index cd3bbb6..1b09414 100644
--- a/src/viminfo.c
+++ b/src/viminfo.c
@@ -1420,9 +1420,9 @@
     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),