755406e622ce53a7ec5be4c5210f783084d9dd0e
angie
  Fri Aug 27 12:39:45 2021 -0700
Fix valgrind warning (although the value from a bad read of [ix+1] wouldn't have been used).

diff --git src/hg/lib/variantProjector.c src/hg/lib/variantProjector.c
index f0a926e..5d1f1fb 100644
--- src/hg/lib/variantProjector.c
+++ src/hg/lib/variantProjector.c
@@ -300,43 +300,46 @@
                                  struct psl *txAli, boolean checkIntrons, char *buf, size_t bufSize)
 /* Splice genomic exons in range into buf and reverse-complement if necessary.
  * If checkIntrons is true then include genomic sequence from "introns" that are too short to be
  * actual introns; use bufSizeForSplicedPlusGInsBases to calc bufSize before calling this. */
 {
 int splicedLen = 0;
 buf[0] = 0;
 int ix;
 for (ix = 0;  ix < txAli->blockCount;  ix++)
     {
     int tBlkStart = txAli->tStarts[ix];
     if (tBlkStart >= gEnd)
         break;
     int tBlkEnd = tBlkStart + txAli->blockSizes[ix];
     appendOverlap(gSeqWin, tBlkStart, tBlkEnd, gStart, gEnd, buf, bufSize, &splicedLen);
+    if (checkIntrons && ix < txAli->blockCount - 1 && gEnd >= tBlkEnd)
+        {
         int tNextBlkStart = txAli->tStarts[ix+1];
-    if (checkIntrons && ix < txAli->blockCount - 1 && gEnd >= tBlkEnd && gStart <= tNextBlkStart &&
+        if (gStart <= tNextBlkStart &&
             pslIntronTooShort(txAli, ix, MIN_INTRON))
             {
             // It's an indel between genome and transcript, not an intron -- add genomic sequence
             int len = tNextBlkStart - tBlkEnd;
             if (len > 0)
                 {
                 seqWindowCopy(gSeqWin, tBlkEnd, len, buf+splicedLen, bufSize-splicedLen);
                 splicedLen += len;
                 }
             }
         }
+    }
 boolean isRc = (pslQStrand(txAli) == '-');
 if (isRc && splicedLen)
     reverseComplement(buf, splicedLen);
 }
 
 static boolean genomeTxMismatch(char *txRef, struct seqWindow *gSeqWin,
                                 uint gStart, uint gEnd, struct psl *txAli)
 /* If the variant overlaps aligned blocks then compare spliced strand-corrected genomic reference
  * sequence with transcript reference sequence.  vpTx start, end and txRef must be in place.
  * Note: this will detect substitutions but not indels by design -- leave it to processIndels
  * and vpTxSetTxAlt to detect indel mismatches. */
 {
 boolean mismatch = FALSE;
 if (isNotEmpty(txRef))
     {