06bfae3c652e7e80784d7f7b19985166bd4dfd69 angie Wed Nov 27 09:58:56 2013 -0800 Fix segfault in databases with no snpNNN tables. diff --git src/hg/hgVai/hgVai.c src/hg/hgVai/hgVai.c index 72e13fe..a5d0a1c 100644 --- src/hg/hgVai/hgVai.c +++ src/hg/hgVai/hgVai.c @@ -520,30 +520,32 @@ endCollapsibleSection(); } char *findLatestSnpTable(char *suffix) /* Return the name of the 'snp1__' table with the highest build number, if any. */ { if (startsWith(hubTrackPrefix, database)) return NULL; if (suffix == NULL) suffix = ""; char query[64]; sqlSafef(query, sizeof(query), "show tables like 'snp1__%s'", suffix); struct sqlConnection *conn = hAllocConn(database); struct slName *snpNNNTables = sqlQuickList(conn, query); hFreeConn(&conn); +if (snpNNNTables == NULL) + return NULL; // Skip to last in list -- highest number (show tables can't use rlike or 'order by'): struct slName *table = snpNNNTables; while (table->next != NULL && isdigit(table->next->name[4]) && isdigit(table->next->name[5])) table = table->next; char *tableName = NULL; if (table != NULL) tableName = cloneString(table->name); slNameFreeList(&snpNNNTables); return tableName; } boolean findSnpBed4(char *suffix, char **retFileName, struct trackDb **retTdb) /* If we can find the latest snpNNNsuffix table, or better yet a bigBed file for it (faster), * set the appropriate ret* and return TRUE, otherwise return FALSE. */ {