851d782e10f818584974de056b992ae15d12abfd
braney
  Thu Jun 9 12:27:46 2016 -0700
make sure that bigChain custom tracks have a "linkDataUrl"   #17325

diff --git src/hg/hgTracks/chainTrack.c src/hg/hgTracks/chainTrack.c
index 0a4310a..95d873c 100644
--- src/hg/hgTracks/chainTrack.c
+++ src/hg/hgTracks/chainTrack.c
@@ -148,31 +148,38 @@
 int maxOverLeft = 0, maxOverRight = 0;
 int overLeft, overRight;
 
 if (tg->items == NULL)		/*Exit Early if nothing to do */
     return;
 
 void *closure;
 struct sqlClosure sqlClosure;
 struct bbClosure bbClosure;
 linkRetrieveFunc queryFunc;
 if (tg->isBigBed)
     {
     closure = &bbClosure;
     queryFunc = doBbQuery;
     char *fileName = trackDbSetting(tg->tdb, "linkDataUrl");
+    if (fileName == NULL)
+        {
+        warn("Cannot find linkDataUrl in custom track \"%s\"\n", tg->shortLabel);
+        return;
+        }
     struct bbiFile *bbi =  bigBedFileOpen(fileName);
+    if (bbi == NULL)
+        return;
     bbClosure.bbi =  bbi;
     }
 else
     {
     closure = &sqlClosure;
     queryFunc = doQuery;
     sqlClosure.conn = hAllocConn(database);
     }
 
 lm = lmInit(1024*4);
 hash = newHash(0);
 
 /* Make up a hash of all linked features keyed by
  * id, which is held in the extras field.  To
  * avoid burning memory on full chromosome views