7745870ea056cab7527a5421f625d5780877662e
braney
  Thu Feb 13 12:36:24 2025 -0800
protect function from getting called with a NULL

diff --git src/hg/lib/hubConnect.c src/hg/lib/hubConnect.c
index 16ed80748ca..475d5d82ee4 100644
--- src/hg/lib/hubConnect.c
+++ src/hg/lib/hubConnect.c
@@ -1353,30 +1353,33 @@
 
 struct hubConnectStatus  *hubList =  hubConnectStatusListFromCart(cart);
 
 char *genarkPrefix = cfgOption("genarkHubPrefix");
 if (genarkPrefix && lookForLonelyHubs(cart, hubList, &newDatabase, genarkPrefix))
     hubList = hubConnectStatusListFromCart(cart);
 
 globalHubList = hubList;
 
 return newDatabase;
 }
 
 char *hubNameFromUrl(char *hubUrl)
 /* Given the URL for a hub, return its hub_# name. */
 {
+if (hubUrl == NULL)
+    return NULL;
+
 char query[PATH_LEN*4];
 sqlSafef(query, sizeof(query), "select concat('hub_', id) from %s where hubUrl = '%s'",
          getHubStatusTableName(), hubUrl);
 struct sqlConnection *conn = hConnectCentral();
 char *name = sqlQuickString(conn, query);
 hDisconnectCentral(&conn);
 return name;
 }
 
 void addPublicHubsToHubStatus(struct cart *cart, struct sqlConnection *conn, char *publicTable, char  *statusTable)
 /* Add urls in the hubPublic table to the hubStatus table if they aren't there already */
 {
 char query[1024];
 sqlSafef(query, sizeof(query),
         "select %s.hubUrl from %s left join %s on %s.hubUrl = %s.hubUrl where %s.hubUrl is NULL",