620af6412b4ca31db9608d127ec4b25c3445955a
braney
  Mon Jun 3 17:28:38 2019 -0700
don't crash if a track specifies a group that doesn't exist in
hgCollection

diff --git src/hg/hgCollection/hgCollection.c src/hg/hgCollection/hgCollection.c
index 4bcd7df..15344c8 100644
--- src/hg/hgCollection/hgCollection.c
+++ src/hg/hgCollection/hgCollection.c
@@ -340,32 +340,34 @@
     }
 if (dif == 0)
     dif = strcasecmp(a->tdb->shortLabel, b->tdb->shortLabel);
 
 return dif;
 }       
 
 static void addVisibleTracks(struct hash *groupHash, struct dyString *rootChildren, struct cart *cart, struct trackDb *trackList)
 // add the visible tracks table rows.
 {
 struct trackDb *tdb;
 struct trackDbRef *tdbRefList = NULL, *tdbRef;
 
 for(tdb = trackList; tdb; tdb = tdb->next)
     {
-    struct grp *grp = hashMustFindVal(groupHash, tdb->grp);
-    double priority =  grp->priority + tdb->priority/100.0;
+    double priority = tdb->priority/100.0;
+    struct grp *grp = hashFindVal(groupHash, tdb->grp);
+    if (grp)
+        priority += grp->priority;
 
     checkForVisible(cart, grp, &tdbRefList, tdb,  priority, 1.0/100.0);
     }
 
 slSort(&tdbRefList, tdbRefCompare);
 if (!isEmpty(rootChildren->string))
     dyStringPrintf(rootChildren, ",");
 dyStringPrintf(rootChildren, "{icon:'../images/folderC.png',id:'visible', text:'Visible Tracks', parent:'#', li_attr:{title:'%s'} ", FOLDER_TITLE);
 if (tdbRefList != NULL)
     dyStringPrintf(rootChildren, ",children:true");
 dyStringPrintf(rootChildren, "}");
 
 jsInlineF("trackData['visible'] = [");
 for(tdbRef = tdbRefList; tdbRef; tdbRef = tdbRef->next)
     {