Fix index out of bound when height < 0 or > 255

Bug report by TNTUP, see #173
This commit is contained in:
ORelio 2016-07-22 23:47:32 +02:00
parent b83985c9fa
commit b99edee642

View file

@ -41,8 +41,15 @@ namespace MinecraftClient.Mapping
/// <param name="location">Location, a modulo will be applied</param>
/// <returns>The chunk, or null if not loaded</returns>
public Chunk GetChunk(Location location)
{
try
{
return this[location.ChunkY];
}
catch (IndexOutOfRangeException)
{
return null;
}
}
}
}