c76af8b5689d4ea3b2c50448d607cc3aa84cbf9a
chmalee
  Fri Jun 7 14:13:52 2019 -0700
Fixing a few spots where I forgot to check for null subgroups earlier, refs #23556

diff --git src/hg/lib/hui.c src/hg/lib/hui.c
index c0eb9f1..2060a93 100644
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@ -4661,31 +4661,31 @@
     // Determine whether subtrack is checked, visible, configurable, has group membership, etc.
     int fourState = subtrackFourStateChecked(subtrack,cart);
     boolean checkedCB = fourStateChecked(fourState);
     boolean enabledCB = fourStateEnabled(fourState);
     boolean visibleCB = fourStateVisible(fourState);
     membership_t *membership = subgroupMembershipGet(subtrack);
     eCfgType cType = cfgNone;
     if (!tdbIsMultiTrack(parentTdb))  // MultiTracks never have configurable subtracks!
 	cType = cfgTypeFromTdb(subtrack,FALSE);
     if (cType != cfgNone)
 	{
 	// Turn off configuring for certain track type or if explicitly turned off
 	int cfgSubtrack = configurableByAjax(subtrack,cType);
 	if (cfgSubtrack <= cfgNone)
 	    cType = cfgNone;
-	else if (membersForAll->members[dimV])
+	else if (membersForAll->members[dimV] && membership != NULL)
 	    {  // subtrack only configurable if more than one subtrack in view
 	       // find "view" in subgroup membership: e.g. "signal"
 	    if (-1 != (ix = stringArrayIx(membersForAll->members[dimV]->groupTag,
 					  membership->subgroups, membership->count)))
 		{
 		int ix2;                       // find "signal" in set of all views
 		if (-1 != (ix2 = stringArrayIx(membership->membership[ix],
 					       membersForAll->members[dimV]->tags,
 					       membersForAll->members[dimV]->count)))
 		    {
 		    if (membersForAll->members[dimV]->subtrackCount[ix2] < 2)
 			cType = cfgNone;
 		    }
 		}
 	    }
@@ -4769,31 +4769,31 @@
     else
 	{
 	cgiMakeCheckBoxFourWay(buffer,checkedCB,enabledCB,id,dyStringContents(dyHtml),
 			       "style='cursor:pointer'");
 	jsOnEventById("click", id, "matSubCbClick(this);");
 	}
 
     if (useDragAndDrop)
 	printf("&nbsp;");
 
     if (!tdbIsMultiTrack(parentTdb))  // MultiTracks never have independent vis
 	{
 	printf("</TD><TD>"); // An extra column for subVis/wrench so dragAndDrop works
 	enum trackVisibility vis = tdbVisLimitedByAncestors(cart,subtrack,FALSE,FALSE);
 	char *view = NULL;
-	if (membersForAll->members[dimV]
+	if (membersForAll->members[dimV] && membership !=NULL
 	&& -1 != (ix = stringArrayIx(membersForAll->members[dimV]->groupTag, membership->subgroups,
 				     membership->count)))
 	    view = membership->membership[ix];
 	char classList[256];
 	if (view != NULL)
 	    safef(classList,sizeof(classList),"clickable fauxInput%s subVisDD %s",
 			    (visibleCB ? "":" disabled"),view); // view should be last!
 	else
 	    safef(classList,sizeof(classList),"clickable fauxInput%s subVisDD",
 			    (visibleCB ? "":" disabled"));
 	#define SUBTRACK_CFG_VIS "<div id='%s_faux' class='%s' style='width:65px;'>%s</div>\n"
 	printf(SUBTRACK_CFG_VIS,subtrack->track,classList,hStringFromTv(vis));
 	char id[256];
 	safef(id, sizeof id, "%s_faux", subtrack->track);
 	jsOnEventByIdF("click", id, "return subCfg.replaceWithVis(this,\"%s\",true);", subtrack->track);
@@ -4887,31 +4887,31 @@
 	printf(" [GEO:%s]", trackDbSetting(subtrack, "accession"));
     compositeMetadataToggle(db,subtrack,NULL,TRUE,FALSE);
     printf("&nbsp;");
 
     // Embedded cfg dialogs are within the TD that contains the longLabel.
     //  This allows a wide item to be embedded in the table
     if (cType != cfgNone)
 	{
 	// How to make this thing float to the left?  Container is overflow:visible
 	// and contained (made in js) is position:relative; left: -{some pixels}
 	#define CFG_SUBTRACK_DIV "<DIV id='div_cfg_%s' class='subCfg %s' style='display:none; " \
 				 "overflow:visible;'></DIV>"
 	#define MAKE_CFG_SUBTRACK_DIV(table,view) \
 					printf(CFG_SUBTRACK_DIV,(table),(view)?(view):"noView")
 	char * view = NULL;
-	if (membersForAll->members[dimV] && -1 !=
+	if (membersForAll->members[dimV] && membership != NULL && -1 !=
 			    (ix = stringArrayIx(membersForAll->members[dimV]->groupTag,
 						membership->subgroups, membership->count)))
 	    view = membership->membership[ix];
 	MAKE_CFG_SUBTRACK_DIV(subtrack->track,view);
 	}
 
     // A schema link for each track
     printf("</td>\n<TD>&nbsp;");
     makeSchemaLink(db,subtrack,"schema");
     printf("&nbsp;");
 
     // Do we have a restricted until date?
     if (restrictions)
 	{
 	char *dateDisplay = encodeRestrictionDate(db,subtrack,FALSE); // includes dates in the past