Avoid infinite loop if oldid and a cookie.

Introduced in 5cc3dfb83f6d2741be88a7f38e63f70dc6c63730.

Change-Id: I3ea96df904f210890d453e2ed0a74c8cfed16f74