diff --git a/ClassicalSharp/Map/Formats/MapLvl.Importer.cs b/ClassicalSharp/Map/Formats/MapLvl.Importer.cs index c0dccc026..26b5917ec 100644 --- a/ClassicalSharp/Map/Formats/MapLvl.Importer.cs +++ b/ClassicalSharp/Map/Formats/MapLvl.Importer.cs @@ -48,12 +48,14 @@ namespace ClassicalSharp.Map { void ReadCustomBlocks(Stream s, int width, int height, int length, byte[] blocks) { byte[] chunk = new byte[16 * 16 * 16]; + byte[] data = new byte[1]; for (int y = 0; y < height; y += 16) for (int z = 0; z < length; z += 16) for (int x = 0; x < width; x += 16) { - if (s.ReadByte() != 1) continue; + int read = s.Read(data, 0, 1); + if (read == 0 || data[0] != 1) continue; s.Read(chunk, 0, chunk.Length); int baseIndex = (y * length + z) * width + x;