ba2a019284cf8b41b243f3a8817763c23d870965
braney
  Mon Jun 15 14:54:55 2026 -0700
prevent hgTracks crash when rearrangement and density graph are both enabled, refs #36668

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

diff --git src/hg/hgTracks/snake.c src/hg/hgTracks/snake.c
index 76337ebe059..2b622239718 100644
--- src/hg/hgTracks/snake.c
+++ src/hg/hgTracks/snake.c
@@ -1242,30 +1242,36 @@
         else
             {
             bitSetRange(qBits, sf->qStart, sf->qEnd - sf->qStart);
             prevSf = sf;
             }
         }
 
     slSort(&lf->components, compare);
     }
 }
 
 void maybeLoadSnake(struct track *track)
 /* check to see if we're doing snakes and if so load the correct methods. */
 {
 boolean doSnake = cartOrTdbBoolean(cart, track->tdb, "doSnake", FALSE);
+
+// the density graph and the rearrangement graph can't both be on at once.
+// if we're wiggling, undo snake mode and use the standard wiggle path.
+if (doSnake && checkIfWiggling(cart, track))
+    doSnake = FALSE;
+
 if (doSnake)
     {
     compareFunction compare;
     if (track->visibility == tvFull)
         compare = snakeFeatureCmpQStart;
     else
         // we don't care about the order on query
         compare = snakeFeatureCmpTStart;
 
     track->drawLeftLabels = snakeDrawLeftLabels;
     track->itemHeight = snakeItemHeight;
     track->totalHeight = snakeHeight;
     track->drawItemAt = snakeDrawAt;
     track->drawItems = snakeDraw;