46d3135f90e8e5255fd8996dea33c1413460fee8
braney
  Wed Mar 22 09:30:34 2017 -0700
fix NULL dereference in bigBed trix search on track hubs

diff --git src/hg/lib/bigBedFind.c src/hg/lib/bigBedFind.c
index a56db26..3031223 100644
--- src/hg/lib/bigBedFind.c
+++ src/hg/lib/bigBedFind.c
@@ -119,37 +119,40 @@
 	{
 	struct sqlConnection *conn = hAllocConnTrack(db, tdb);
 	fileName = bbiNameFromSettingOrTable(tdb, conn, tdb->table);
 	hFreeConn(&conn);
 	}
 
     if (!(indexField && fileName))
 	continue;
 
     struct slName *indexList = slNameListFromString(indexField, ',');
     struct hgPos *posList1 = NULL, *posList2 = NULL;
     char *trixFile = trackDbSetting(tdb, "searchTrix");
     // if there is a trix file, use it to search for the term
     if (trixFile != NULL)
 	{
-	char buf[2048];
 	char *description = NULL;
-	if (hfs && isNotEmpty(hfs->searchDescription))
+	if (hfs)
+            {
+            char buf[2048];
+            if (isNotEmpty(hfs->searchDescription))
                 truncatef(buf, sizeof(buf), "%s", hfs->searchDescription);
             else
                 safef(buf, sizeof(buf), "%s", hfs->searchTable);
             description = cloneString(buf);
+            }
 	posList1 = doTrixSearch(hReplaceGbdb(trixFile), indexList, fileName, term, description);
 	}
 
     // now search for the raw id's
     struct slName *oneIndex=indexList;
     for (; oneIndex; oneIndex = oneIndex->next)
 	{
 	posList2 = getPosFromBigBed(fileName, oneIndex->name, term, NULL);
 	posList1 = slCat(posList1, posList2);
 	}
 
     if (posList1 != NULL)
 	{
 	struct hgPosTable *table;