d833738fcd5c2f1eebc0d4242eeb87ac76f71005
chmalee
  Mon Apr 29 09:30:46 2024 -0700
Fix bug found by Hiram when drag selecting to zoom or highlight, refs Hiram email

diff --git src/hg/js/hui.js src/hg/js/hui.js
index 43ee980..9d110f9 100644
--- src/hg/js/hui.js
+++ src/hg/js/hui.js
@@ -1488,33 +1488,33 @@
             setCartVars([common.track + ".highlightColor"], [hlColor], null, true);
         } else if (trackName) {
             // hgTrackUi pop up
             cart.setVars([trackName + ".highlightColor"], [hlColor], null, false);
         } else {
             // hgTracks dragSelect, uses different cart variable
             cart.setVars(["prevHlColor"], [hlColor], null, false);
         }
         prevHlColor = hlColor;
         return hlColor;
     };
 
     let loadHlColor = function() {
         // load hlColor from prevHlColor in the cart, or use default color, set and return it
         // color is a 6-char hex string prefixed by #
-        if (prevHlColor) {
+        if (typeof prevHlColor !== "undefined" && prevHlColor.length > 0) {
             hlColor = prevHlColor;
-        } else if (cartHighlightColor) {
+        } else if (typeof cartHighlightColor !== "undefined" && cartHighlightColor.length > 0) {
             hlColor = cartHighlightColor;
         } else {
             hlColor = hlColorDefault;
         }
         return hlColor;
     };
 
     let colorPickerContainer = document.createElement("p");
     colorPickerContainer.textContent = "Highlight color:";
     let inpText = document.createElement("input");
     inpText.id = inputId + "Input";
     inpText.value = loadHlColor();
     inpText.type = "text";
     inpText.style = "width: 70px";
     // The actual color picker: