af6898753ba6d5f3872957cd270872ce4c4e3dfc
max
  Tue Apr 11 08:19:27 2023 -0700
tolerate if browser CSS theme files do not exist, cleaning up the resource link mess a little, refs #7867

diff --git src/hg/lib/cart.c src/hg/lib/cart.c
index 9745626..f3f295a 100644
--- src/hg/lib/cart.c
+++ src/hg/lib/cart.c
@@ -2626,32 +2626,32 @@
     char buf[512];
     safef(buf, sizeof(buf), "<link rel='stylesheet' href='%s' type='text/css'>", styleFile);
     char *copy = cloneString(buf);
     htmlSetStyleTheme(copy); // for htmshell.c, used by hgTracks
     webSetStyle(copy);       // for web.c, used by hgc
     }
 
 if (isNotEmpty(cartTheme))
     {
     char *themeKey = catTwoStrings("browser.theme.", cartTheme);
     styleFile = cfgOption(themeKey);
     freeMem(themeKey);
     if (isEmpty(styleFile))
         return;
 
-    char * link = webTimeStampedLinkToResourceOnFirstCall(styleFile, TRUE); // resource file link wrapped in html
-    if (link != NULL)
+    char * link = webCssLink(styleFile, FALSE); // resource file link wrapped in html
+    if (link != NULL && !sameOk(link, "<>")) // "<>" means "default settings" = "no file"
         {
         htmlSetStyleTheme(link); // for htmshell.c, used by hgTracks
         webSetStyle(link);       // for web.c, used by hgc
         }
     }
 }
 
 void cartSetLastPosition(struct cart *cart, char *position, struct hash *oldVars)
 /* If position and oldVars are non-NULL, and oldVars' position is different, add it to the cart
  * as lastPosition.  This is called by cartHtmlShell{,WithHead} but not other cart openers;
  * it should be called after cartGetPosition or equivalent. */
 {
 if (position != NULL && oldVars != NULL)
     {
     struct hashEl *oldPos = hashLookup(oldVars, positionCgiName);