386f529b5d3c7d47634af4c01b8bb2364382323d
braney
  Tue Feb 1 11:35:39 2011 -0800
check to see if HTTP_HOST is null before assuming that it isn't
diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c
index 75d43e8..df8601e 100644
--- src/hg/lib/hdb.c
+++ src/hg/lib/hdb.c
@@ -3031,31 +3031,36 @@
 
 hash = tableListGetDbHash(db);
 hel = hashLookup(hash, rootName);
 if (hel == NULL)
     return NULL;
 else
     return slNameCloneList((struct slName *)(hel->val));
 }
 
 boolean hHostHasPrefix(char *prefix)
 /* Return TRUE if this is running on web-server with host name prefix */
 {
 if (prefix == NULL) 
     return FALSE;
 
-return startsWith(prefix, getenv("HTTP_HOST"));
+char *httpHost = getenv("HTTP_HOST");
+
+if (httpHost == NULL)
+    return FALSE;
+
+return startsWith(prefix, httpHost);
 }
 
 boolean hIsPrivateHost()
 /* Return TRUE if this is running on private (development) web-server. 
  * This was originally genome-test as well as hgwdev, however genome-test
  * may be repurposed to direct users to the preview site instead of development site. */
 {
 return hHostHasPrefix("hgwdev");
 }
 
 boolean hIsPreviewHost()
 /* Return TRUE if this is running on preview web-server.  The preview
  * server is a mirror of the development server provided for public
  * early access. */
 {