Jump to content

Bug: NullReferenceException in cache search

Ville Saari

Recommended Posts

This query: http://www.geocaching.com/seek/nearest.aspx?u=Teemu+Laitinen

will only return the first page correctly. Clicking "Next" gives the following stack trace:

System.NullReferenceException: Object reference not set to an instance of an object. at Geocaching.UI.geocaching_nearest.dlResults_ItemDataBound(Object sender, DataListItemEventArgs e) at System.Web.UI.WebControls.DataList.OnItemDataBound(DataListItemEventArgs e) at System.Web.UI.WebControls.DataList.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) at System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) at System.Web.UI.WebControls.BaseDataList.DataBind() at Geocaching.UI.geocaching_nearest.ProcessResults(OriginWpt OriginWpt) at Geocaching.UI.geocaching_nearest.DisplayPageResultData()

The result is repatably and consistently the same and doesn't seem to depend on the web browser or operating system used. I get the exact same result with Firefox on Linux and Safari 2.0.4 on MacOS.


It doesn't happen if I search for example caches by some other user. This particular example is the only case I have discovered so far that triggers this bug.

Link to comment

I found more cases where the bug is triggered. It seems to depend on the number of caches on the last page of the search results. Whenever this number is 13 the bug appears, but only if there is advertisements within the search results (i.e. the page is retrieved anonymously or using a regular account).

Link to comment

My original example doesn't trigger the bug any more because that cacher has hidden more caches but the bug still exists. It appears whenever the number of results in a cache search satisfies the equation x mod 20 = 13 and the search is done using a regular account or not logged in.


I.e. 13, 33, 53, 73... An easy way to get a specific number is to do a distance search and adjust the distance until the required number of caches fits in the circle.

Link to comment

Are you sure this is still happening? Lq's link returns 13 caches for me but I do not see an error.


Yes, it is most definitely happenig! As stated above, please try with either a regular (non premium) account or by not logging in at all. Seems to me that the most obvious solution is to remove the adds, until you can figure out where the bug is. My guess is, that some part of the code still assumes that adds should be inserted in different slots of the listing, than what currently is praxis. Now between items 1. & 2. and 14. & 15. of the cahe listing. If I remember correctly, this was different not so long ago.

Link to comment
This topic is now closed to further replies.
  • Create New...