GetTileWithNoLock throws exception

Topics: General
May 10, 2012 at 8:09 AM

Hello Mr.RadionMan,

The following 'if' condition is commented out in GetTileWithNoLock function:

public Tile GetTileWithNoLock(int zoom, GPoint p)
      {
         Tile ret = null;

         //if(zoom < Levels.Count)
         {
            Levels[zoom].TryGetValue(p, out ret);
         }

         return ret;
      }

But, the size of the list "Levels" is 33. At times, we get the zoom level as 50,  which is causing the exception.

Exception details:

************* Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at GMap.NET.Internals.TileMatrix.GetTileWithNoLock(Int32 zoom, GPoint p) TileMatrix.cs:line 172

Is there any reason why the 'if' condition is commented out?

 

Thanks in Advance

Coordinator
May 10, 2012 at 8:43 AM

there is no level 50, not even 30