571504b8602e77298d8b8d7cbdf5bddc348e6020
angie
  Fri Sep 21 15:53:28 2018 -0700
hgSuggest, when invoked with no params, was getting a SEGV instead of printing a 'Status: 400' header and error message.  There were two problems: a param was being used before the test for lack of params, and htmlVaBadRequestAbort was used only as an AbortHandler -- it needs to be a WarnHandler, otherwise the error message is printed out before the header.  A couple other places also needed to install htmlVaBadRequestAbort as a WarnHandler not just AbortHandler.

diff --git src/hg/hgSuggest/hgSuggest.c src/hg/hgSuggest/hgSuggest.c
index 87a7581..08f258c 100644
--- src/hg/hgSuggest/hgSuggest.c
+++ src/hg/hgSuggest/hgSuggest.c
@@ -9,51 +9,50 @@
 #include "cheapcgi.h"
 #include "htmshell.h"
 #include "dystring.h"
 #include "jsonParse.h"
 #include "suggest.h"
 #include "genbank.h"
 
 
 int main(int argc, char *argv[])
 {
 long enteredMainTime = clock1000();
 
 cgiSpoof(&argc, argv);
 char *prefix = cgiOptionalString("prefix");
 char *database = cgiOptionalString("db");
-
-initGenbankTableNames(database);
-
 int exact = cgiOptionalInt("exact", 0);
-struct sqlConnection *conn;
 char query[2048];
 char **row;
 struct sqlResult *sr;
 int count = 0;
 boolean hasKnownCanonical;
 struct dyString *str = newDyString(10000);
 char *table;
 
+pushWarnHandler(htmlVaBadRequestAbort);
 pushAbortHandler(htmlVaBadRequestAbort);
 if(prefix == NULL || database == NULL)
     errAbort("%s", "Missing prefix and/or db CGI parameter");
 
-conn = hAllocConn(database);
+initGenbankTableNames(database);
+struct sqlConnection *conn = hAllocConn(database);
 table = connGeneSuggestTable(conn);
 if(table == NULL)
     errAbort("gene autosuggest is not supported for db '%s'", database);
+popWarnHandler();
 popAbortHandler();
 
 hasKnownCanonical = sameString(table, "knownCanonical");
 
 puts("Content-Type:text/plain");
 puts("\n");
 
 dyStringPrintf(str, "[\n");
 
 if(exact)
     {
     // NOTE that exact is no longer used by the UI as of v271, but there are still some robots using it so we still support it.
     if(hasKnownCanonical)
         sqlSafef(query, sizeof(query), "select x.geneSymbol, k.chrom, kg.txStart, kg.txEnd, x.kgID, x.description "
               "from knownCanonical k, knownGene kg, kgXref x where k.transcript = x.kgID and k.transcript = kg.name "