diff --git a/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs b/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs index c31a2c0..11de14b 100644 --- a/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs +++ b/src/DotRecast.Detour.TileCache/TileCacheBuilder.cs @@ -1492,7 +1492,7 @@ namespace DotRecast.Detour.TileCache } // Remove vertex. - for (int i = rem; i < mesh.nverts; ++i) + for (int i = rem; i < mesh.nverts - 1; ++i) { mesh.verts[i * 3 + 0] = mesh.verts[(i + 1) * 3 + 0]; mesh.verts[i * 3 + 1] = mesh.verts[(i + 1) * 3 + 1];