dc72399cedb4c14ba3bb92c57f4dc4c1b1c3da75
max
  Fri Jan 17 10:02:19 2014 -0800
adding additional null pointer checks, just in case
diff --git src/hg/lib/jksql.c src/hg/lib/jksql.c
index 65a6ae5..c3fd729 100644
--- src/hg/lib/jksql.c
+++ src/hg/lib/jksql.c
@@ -930,33 +930,36 @@
                                           char *database)
 /* Connect to database somewhere as somebody. Database maybe NULL to
  * just connect to the server.  Return NULL can't connect */
 {
 return sqlConnRemote(host, 0, NULL, user, password, database, FALSE);
 }
 
 static struct sqlConnection *sqlConnProfile(struct sqlProfile* sp, char *database, boolean abort)
 /* Connect to database using the profile.  Database maybe NULL to connect to
  * the server. Optionally abort on failure. */
 {
 struct sqlConnection *sc;
 
 // connect with the default profile
 sc = sqlConnRemote(sp->host, sp->port, sp->socket, sp->user, sp->password, database, abort);
+if (sc!=NULL)
     sc->profile = sp; // remember the profile
 
 // optionally prepare the slower failover connection
+if (sp->name==NULL)
+    return sc;
 char *slowProfName = catTwoStrings("slow-", sp->name);
 struct sqlProfile *slow = sqlProfileGet(slowProfName, database);
 freez(&slowProfName);
 
 if (slow==NULL)
     return sc;
 
 // don't connect the slow connection yet: lazily connect later when needed; saves 0.5
 // seconds per connection on transatlantic links
 // instead create a "placeholder" sqlConnection with all connection data, but no connection
 struct sqlConnection *slowSc;
 AllocVar(slowSc);
 slowSc->profile = slow; // remember the profile
 slowSc->db = database;
 slowSc->hasTableCache = -1;