c20b4a95fa8dd3d0c4d57252d0e639c7695e3adc
angie
  Fri Feb 26 14:56:16 2016 -0800
Adding a NULL check before using oldVars.

diff --git src/hg/lib/cart.c src/hg/lib/cart.c
index dde5943..f6603ed 100644
--- src/hg/lib/cart.c
+++ src/hg/lib/cart.c
@@ -761,35 +761,38 @@
 if (cartVarExists(cart, hgHubDoDisconnect))
     doDisconnectHub(cart);
 
 pushWarnHandler(cartHubWarn);
 char *newDatabase = hubConnectLoadHubs(cart);
 popWarnHandler();
 
 #ifndef GBROWSE
 if (didSessionLoad)
     cartCopyCustomTracks(cart);
 #endif /* GBROWSE */
 
 if (newDatabase != NULL)
     {
     // this is some magic to use the defaultPosition and reset cart variables
+    if (oldVars)
+        {
         struct hashEl *hel;
         if ((hel = hashLookup(oldVars,"db")) != NULL)
             hel->val = "none";
         else
             hashAdd(oldVars, "db", "none");
+        }
     cartSetString(cart,"db", newDatabase);
     }
 
 if (exclude != NULL)
     {
     while ((ex = *exclude++))
 	cartExclude(cart, ex);
     }
 
 cartDefaultDisconnector(&conn);
 
 if (didSessionLoad)
     cartHideDefaultTracks(cart);
 return cart;
 }