b7c6d6156dde49066ac21e4d0288b80faf85ae16
braney
  Mon Jul 22 14:45:14 2019 -0700
don't crash if a requested mrna from search isn't aligned

diff --git src/hg/lib/hgFind.c src/hg/lib/hgFind.c
index 8d533c0..76893cd 100644
--- src/hg/lib/hgFind.c
+++ src/hg/lib/hgFind.c
@@ -1672,31 +1672,34 @@
     char *organism = hOrganism(hgp->database);      /* dbDb organism column */
     if (alignCount == 1)
         {
         // So far we have not bothered to look up the coordinates because there are almost always
         // multiple matches among which the user will have to choose.  However, it is possible
         // for there to be a unique match (hgwdev 19-02-15, hg38, "elmer" --> U01022).  In that
         // case we should look up the coordinates so the user doesn't have to click through a page
         // with one match leading to another search.
         char shortLabel[256];
         safef(shortLabel, sizeof shortLabel, "%s%s %sligned mRNAs",
               isXeno ? "Non-" : "", organism,
               aligns ?  "A" : "Una");
         char *acc = table->posList->name;
         struct psl *pslList = getPslFromTable(conn, hgp->database, mrnaTable, acc);
         addPslResultToHgp(hgp, hgp->database, mrnaTable, shortLabel, acc, pslList);
+        if (hgp->tableList)
             alignCount = slCount(hgp->tableList->posList);
+        else 
+            alignCount = 0;
         }
     else
         {
         char title[256];
         slReverse(&table->posList);
         safef(title, sizeof(title), "%s%s %sligned mRNA Search Results",
               isXeno ? "Non-" : "", organism,
               aligns ?  "A" : "Una");
         table->description = cloneString(title);
         table->name = cloneString(mrnaTable);
         table->htmlOnePos = mrnaKeysHtmlOnePos;
         slAddHead(&hgp->tableList, table);
         }
     freeMem(organism);
     }