f9d03e79d5565c0d9a28d57c0c67986a085a40c4
kent
  Tue Dec 14 21:09:37 2021 -0800
Fixing a three little bugs.  Adding some #defines to avoid magic numbers. Fixing differences in sorting between expression values and labels.

diff --git src/hg/hgTracks/barChartTrack.c src/hg/hgTracks/barChartTrack.c
index 6885d9b..9d99304 100644
--- src/hg/hgTracks/barChartTrack.c
+++ src/hg/hgTracks/barChartTrack.c
@@ -422,41 +422,43 @@
 int standardSize =  chartStandardWidth(tg, itemInfo);
 struct barChartTrack *extras = tg->extraUiData;
 if (extras->stretchToItem)
     return max(standardSize, itemSize);
 else
     return standardSize;
 }
 
 
 static void  mergeBedScores( struct facetedTableMergedOffset *facetsMergeList, 
     struct bed *bedList)
 /* Return a merged down version of bed.  Bed serves as both input and output.  */
 /* Maybe a use for a nondestructive-to-inputs version will come up soon. This one is faster
  * for the first use case though. */
 {
+if (bedList == NULL)
+    return;
 int outSize = slCount(facetsMergeList);
 if (outSize > bedList->expCount)
      {
      errAbort("problem in mergeBedScores(): bed->expCount = %d, outSize = %d", 
 	bedList->expCount, outSize);
      }
 float outBuf[outSize];
 struct bed *bed;
 for (bed = bedList; bed != NULL; bed = bed->next)
     {
-    facetedTableMergeVals(facetsMergeList, bed->expScores, outBuf);
+    facetedTableMergeVals(facetsMergeList, bed->expScores, bed->expCount, outBuf, outSize);
     bed->expCount = outSize;
     memcpy(bed->expScores, outBuf, sizeof(outBuf));
     }
 }
 
 static void barChartLoadItems(struct track *tg)
 /* Load method for track items */
 {
 /* Initialize colors for visibilities that don't display actual barchart */
 if (tg->visibility == tvSquish || tg->limitedVis == tvSquish)
     tg->itemColor = barChartItemColor;
 tg->colorShades = shadesOfGray;
 
 /* Get track UI info */
 struct barChartTrack *extras;