361c03dcbf16893e92db9a168c4c976cfd5736e7
braney
  Wed Oct 5 16:31:47 2022 -0700
make chromSeqFileExists() do as it says it does and check for the
existence of the chromInfo table before querying it.

diff --git src/hg/lib/chromInfo.c src/hg/lib/chromInfo.c
index 5c307f4..328c894 100644
--- src/hg/lib/chromInfo.c
+++ src/hg/lib/chromInfo.c
@@ -128,33 +128,34 @@
 fputc(lastSep,f);
 }
 
 /* -------------------------------- End autoSql Generated Code -------------------------------- */
 
 boolean chromSeqFileExists(char *db, char *chrom)
 /* Check whether chromInfo exists for a database, find the path of the */
 /* sequence file for this chromosome and check if the file exists. */
 {
 char seqFile[512];
 struct sqlConnection *conn = sqlConnect(db);
 char query[256];
 char *res = NULL;
 boolean exists = FALSE;
 
-/* if the database exists, check for the chromInfo file */
-if (sqlDatabaseExists(db))
+/* if the database exists (which it must since we opened the connection above), check for the chromInfo table */
+if (sqlDatabaseExists(db) && sqlTableExists(conn, "chromInfo"))
     {
+    /* the database and chromInfo table exist, look to see if it has our chrom. */
     sqlSafef(query, sizeof(query), "select fileName from chromInfo where chrom = '%s'", chrom);
     res = sqlQuickQuery(conn, query, seqFile, 512);
     sqlDisconnect(&conn);
     }
 
 /* if there is not table or no information in the table or if the table */
 /* exists but the file can not be opened return false, otherwise sequence */
 /* file exists and return true */
 if (res != NULL)
     {
     char *seqFile2 = hReplaceGbdb(seqFile);
     exists = udcExists(seqFile2);
     freeMem(seqFile2);
     }
 return exists;