010882a6948505235ea0516ca085178b70299eb8
braney
  Fri Mar 24 15:10:45 2023 -0700
fix bug in squishyPack if squishy part was empty

diff --git src/hg/hgTracks/imageV2.c src/hg/hgTracks/imageV2.c
index cdfd9f2..bef93c4 100644
--- src/hg/hgTracks/imageV2.c
+++ src/hg/hgTracks/imageV2.c
@@ -1990,31 +1990,31 @@
 struct imgTrack *smashSquish(struct imgTrack *imgTrackList)
 /* Javascript doesn't know about our trick to do squishyPack so we need to pass it a single div instead of two. 
  * We assume that the linked track immediately follows the original track in the sorted list. */
 {
 struct imgTrack *nextImg, *imgTrack;
 
 for (imgTrack = imgTrackList; imgTrack!=NULL;imgTrack = nextImg)
     {
     nextImg = imgTrack->next;
     boolean joinNext =  ((nextImg != NULL)  && nextImg->linked);
 
     if (joinNext)  // Smash these together
         {
         struct imgSlice *packedSlices = imgTrack->slices;
         struct imgSlice *squishSlices = imgTrack->next->slices;
-        for(; packedSlices; packedSlices = packedSlices->next, squishSlices = squishSlices->next)
+        for(; packedSlices && squishSlices; packedSlices = packedSlices->next, squishSlices = squishSlices->next)
             {
             if (packedSlices->type != stCenter)
                 {
                 if ((packedSlices->map != NULL) && (squishSlices->map != NULL))
                     packedSlices->map->items = slCat(packedSlices->map->items, squishSlices->map->items);
                 packedSlices->height += squishSlices->height;
                 }
             }
         imgTrack->next = nextImg->next;
         nextImg = nextImg->next;
         }
     }
 
 return imgTrackList;
 }