b4d43329da1df630ed2a970921b5e135f3aa9771
chmalee
  Fri Aug 25 17:50:13 2023 -0700
Fix typo in typeof check, caught by Lou no refs

diff --git src/hg/js/hgSearch.js src/hg/js/hgSearch.js
index 673662a..e6afb2b 100644
--- src/hg/js/hgSearch.js
+++ src/hg/js/hgSearch.js
@@ -787,41 +787,41 @@
     }
 
     function switchAssemblies(newDb) {
         // reload the page to attach curated hub (if any)
         re = /db=[\w,\.]*/;
         window.location = window.location.href.replace(re,"db="+newDb);
     }
 
     function init() {
         cart.setCgi('hgSearch');
         cart.debug(debugCartJson);
         // If a user clicks search before the page has finished loading
         // start processing it now:
         $("#searchBarSearchButton").click(sendUserSearch);
         if (typeof cartJson !== "undefined") {
-            if (cartJson.db !== undefined) {
+            if (typeof cartJson.db !== "undefined") {
                 db = cartJson.db;
             } else {
                 alert("Error no database from request");
             }
-            if (typeof cartJson.warning !== undefined) {
+            if (typeof cartJson.warning !== "undefined") {
                 alert("Warning: " + cartJson.warning);
             }
             // check right away for a special redirect to hgTracks:
-            if (typeof cartJson.warning === undefined &&
-                    cartJson.positionMatches !== undefined &&
+            if (typeof cartJson.warning === "undefined" &&
+                    typeof cartJson.positionMatches !== "undefined" &&
                     cartJson.positionMatches.length == 1 &&
                     cartJson.positionMatches[0].matches[0].doRedirect === true) {
                 positionMatch = cartJson.positionMatches[0];
                 match = positionMatch.matches[0];
                 position = match.position;
                 newUrl = "../cgi-bin/hgTracks" + "?db=" + db + "&position=" + position;
                 if (match.highlight) {
                     newUrl += "&addHighlight=" + match.highlight;
                 }
                 if (positionMatch.name !== "chromInfo") {
                     newUrl += "&" + positionMatch.name + "=pack";
                 }
                 window.location.replace(newUrl);
             }
             var urlParts = {};