src/hg/hgTracks/hgTracks.c 1.1566

1.1566 2009/05/15 17:02:32 tdreszer
Restore last position if newly requested position proves invalid.
Index: src/hg/hgTracks/hgTracks.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/hgTracks.c,v
retrieving revision 1.1565
retrieving revision 1.1566
diff -b -B -U 4 -r1.1565 -r1.1566
--- src/hg/hgTracks/hgTracks.c	12 May 2009 00:00:37 -0000	1.1565
+++ src/hg/hgTracks/hgTracks.c	15 May 2009 17:02:32 -0000	1.1566
@@ -4265,10 +4265,15 @@
 if (isGenome(position) || NULL ==
     (hgp = findGenomePos(database, position, &chromName, &winStart, &winEnd, cart)))
     {
     if (winStart == 0)	/* number of positions found */
-	hgp = findGenomePos(database, defaultPosition, &chromName, &winStart, &winEnd,
-			    cart);
+        {
+        freeMem(position);
+        position = cloneString(cartUsualString(cart, "lastPosition", defaultPosition));
+        hgp = findGenomePos(database, position, &chromName, &winStart, &winEnd,cart);
+        if(hgp != NULL && position != defaultPosition)
+            cartSetString(cart, "position", position);
+        }
     }
 
 if (NULL != hgp && NULL != hgp->tableList && NULL != hgp->tableList->name)
     {