ecd08dbab77a75577aaf4cc5d70c4f21b6ca3aa1
braney
  Wed Jul 20 12:09:13 2011 -0700
fix segvio; if udcDir can't be opened.  Add Hub clear from command line.
diff --git src/hg/lib/trackHub.c src/hg/lib/trackHub.c
index c0a67da..47d9aa1 100644
--- src/hg/lib/trackHub.c
+++ src/hg/lib/trackHub.c
@@ -479,26 +479,29 @@
 struct errCatch *errCatch = errCatchNew();
 struct trackHub *hub = NULL;
 int retVal = 0;
 
 if (errCatchStart(errCatch))
     hub = trackHubOpen(hubUrl, "");
 errCatchEnd(errCatch);
 
 if (errCatch->gotError)
     {
     retVal = 1;
     dyStringPrintf(errors, "%s", errCatch->message->string);
     }
 errCatchFree(&errCatch);
 
+if (hub == NULL)
+    return 1;
+
 verbose(2, "hub %s\nshortLabel %s\nlongLabel %s\n", hubUrl, hub->shortLabel, hub->longLabel);
 verbose(2, "%s has %d elements\n", hub->genomesFile, slCount(hub->genomeList));
 struct trackHubGenome *genome;
 for (genome = hub->genomeList; genome != NULL; genome = genome->next)
     {
     retVal |= hubCheckGenome(hub, genome, errors);
     }
 trackHubClose(&hub);
 
 return retVal;
 }