From b99edee6423d14165cc6d6a03a1ab1186db95f2a Mon Sep 17 00:00:00 2001 From: ORelio Date: Fri, 22 Jul 2016 23:47:32 +0200 Subject: [PATCH] Fix index out of bound when height < 0 or > 255 Bug report by TNTUP, see #173 --- MinecraftClient/Mapping/ChunkColumn.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MinecraftClient/Mapping/ChunkColumn.cs b/MinecraftClient/Mapping/ChunkColumn.cs index 26cbab39..007bdb22 100644 --- a/MinecraftClient/Mapping/ChunkColumn.cs +++ b/MinecraftClient/Mapping/ChunkColumn.cs @@ -42,7 +42,14 @@ namespace MinecraftClient.Mapping /// The chunk, or null if not loaded public Chunk GetChunk(Location location) { - return this[location.ChunkY]; + try + { + return this[location.ChunkY]; + } + catch (IndexOutOfRangeException) + { + return null; + } } } }