ea82eeb86ad5cf92ddf795f2d6f9ce84e33e52d5
chmalee
  Wed Jul 29 11:20:16 2026 -0700
Stop hubApi /search from crashing on position matches and curated hub genomes. refs #37956

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c
index cb87a1236e4..06748ec09d8 100644
--- src/hg/lib/hdb.c
+++ src/hg/lib/hdb.c
@@ -112,31 +112,33 @@
 char *cladeTable()
 /* Return the name of the clade table. */
 {
 static char *cladeTable = NULL;
 if (cladeTable == NULL)
     cladeTable = cfgOptionEnvDefault("HGDB_CLADETABLE",
 	    cladeTableConfVariable, defaultCladeTableName);
 return cladeTable;
 }
 
 static struct chromInfo *lookupChromInfo(char *db, char *chrom)
 /* Query db.chromInfo for the first entry matching chrom. */
 {
 struct chromInfo *ci = NULL;
 
-if (trackHubDatabase(db))
+/* An assembly hub keeps its sequence in a 2bit file and has no chromInfo table.  A curated
+ * hub reaches us as an undecorated db name, so check the undecorated hub genomes too. */
+if (trackHubDatabase(db) || trackHubGetGenomeUndecorated(trackHubSkipHubName(db)) != NULL)
     {
     ci = trackHubMaybeChromInfo(db, chrom);
     return ci;
     }
 
 struct sqlConnection *conn = hAllocConn(db);
 struct sqlResult *sr = NULL;
 char **row = NULL;
 char query[256];
 sqlSafef(query, sizeof(query), "select * from chromInfo where chrom = '%s'",
       chrom);
 sr = sqlGetResult(conn, query);
 if ((row = sqlNextRow(sr)) != NULL)
     {
     ci = chromInfoLoad(row);