0c3b406bfe4ec8ece2b53a6207c252029b6ddfc2 tdreszer Fri Jun 10 13:29:13 2011 -0700 Simple bullet-proofing against tdb->table being empty. diff --git src/hg/hgTables/hgTables.c src/hg/hgTables/hgTables.c index 79f705b..d860c17 100644 --- src/hg/hgTables/hgTables.c +++ src/hg/hgTables/hgTables.c @@ -234,30 +234,39 @@ grp->label = cloneString(hub->shortLabel); return grp; } static struct trackDb *getFullTrackList(struct hubConnectStatus *hubList, struct grp **pHubGroups) /* Get all tracks including custom tracks if any. */ { struct trackDb *list = hTrackDb(database); struct customTrack *ctList, *ct; /* exclude any track with a 'tableBrowser off' setting */ struct trackDb *tdb, *nextTdb, *newList = NULL; for (tdb = list; tdb != NULL; tdb = nextTdb) { nextTdb = tdb->next; + if (tdbIsDownloadsOnly(tdb) || tdb->table == NULL) + { + //freeMem(tdb); // should not free tdb's. + // While hdb.c should and says it does cache the tdbList, it doesn't. + // The most notable reason that the tdbs are not cached is this hgTables CGI !!! + // It needs to be rewritten to make tdbRef structures for the lists it creates here! + continue; + } + char *tbOff = trackDbSetting(tdb, "tableBrowser"); if (tbOff != NULL && startsWithWord("off", tbOff)) slAddHead(&forbiddenTrackList, tdb); else slAddHead(&newList, tdb); } slReverse(&newList); list = newList; /* add wikiTrack if enabled */ if (wikiTrackEnabled(database, NULL)) wikiTrackDb(&list); /* Add hub tracks. */ struct hubConnectStatus *hubStatus;