56ea4a038024442a203bb806c0779635c02925b8
braney
  Wed Nov 6 10:01:43 2024 -0800
oops... was stepping one beyond the array end

diff --git src/hg/hgTracks/wigTrack.c src/hg/hgTracks/wigTrack.c
index c13d722..5864907 100644
--- src/hg/hgTracks/wigTrack.c
+++ src/hg/hgTracks/wigTrack.c
@@ -72,34 +72,34 @@
     {
     unsigned color;
     if (colorTrack->isColorBigBed)
         color = bedColorToGfxColor(lf->filterColor);
     else
         color = colorTrack->ixAltColor;
 
     for (sf = lf->components; sf != NULL; sf = sf->next)
 	{
 	x1 = round((double)((int)sf->start-winStart)*scale);
 	x2 = round((double)((int)sf->end-winStart)*scale);
 
         // make sure x1 is at least zero and not greater than the array size
 	if(x1 < 0)
 	    x1 = 0;
-        else if (x1 > colSize) 
+        else if (x1 >= colSize) 
             break;
 
-        // make sure x2 is at least one bigger than x1 and that it's not bigger than the array
+        // make sure x2 is at least one bigger than x1 and that it's not bigger than the array size + 1
 	if(x1 == x2)
 	    x2++;
 	if(x2 > colSize)
 	    x2 = colSize;
 
 	for(i = x1; i < x2; i++)
             colArray[i] = color;
 	}
     }
 }
 
 static void wigFillInColorBedArray(struct track *wigTrack, Color *colArray, int colSize,
 				  struct track *colorTrack, struct hvGfx *hvg)
 /* Fill in a color array with the simple bed based colorTrack's
    color where it would normally have an block. */