1c671b88fa7165c11637bafd70979a98b010f141
max
  Fri Jul 4 08:21:20 2025 -0700
fixing barchart bug, refs #36034

diff --git src/hg/hgTracks/barChartTrack.c src/hg/hgTracks/barChartTrack.c
index f5e437c7f99..de55e4857e8 100644
--- src/hg/hgTracks/barChartTrack.c
+++ src/hg/hgTracks/barChartTrack.c
@@ -210,33 +210,36 @@
 		}
 	    return;
 	    }
 	}
     /* no filter */
     for (categ = extras->categories; categ != NULL; categ = categ->next)
 	hashAdd(extras->categoryFilter, categ->name, categ->name);
     }
 }
 
 static int filteredCategoryCount(struct barChartTrack *extras)
 /* Count of categories to display */
 {
 if (extras->facetsMergeList != NULL)
     return slCount(extras->facetsMergeList);
-else
+else {
+    if (extras->categoryFilter==NULL)
+        errAbort("Internal error: the number of barchart colors doesn't match the barchart labels");
     return hashNumEntries(extras->categoryFilter);
 }
+}
 
 static boolean filterCategory(struct barChartTrack *extras, char *name)
 /* Does category pass filter */
 {
 if (name == NULL)
     return FALSE;
 else if (extras->facetsMergeList)
     return TRUE;
 return (hashLookup(extras->categoryFilter, name) != NULL);
 }
 
 static int maxCategoryForItem(struct bed *bed)
 /* Return id of highest valued category for an item, if significantly higher than median.
  * If none are over threshold, return -1 */
 {