From 6e8581400a8dd092453664367b81a981aefd43ed Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Sun, 4 Oct 2009 16:12:37 +0000 Subject: [PATCH] Fixed bug where removeVertex() would crash with certain meshes because vflags array was not adjusted properly. --- Recast/Source/RecastMesh.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Recast/Source/RecastMesh.cpp b/Recast/Source/RecastMesh.cpp index 695a192..cf412be 100644 --- a/Recast/Source/RecastMesh.cpp +++ b/Recast/Source/RecastMesh.cpp @@ -997,7 +997,8 @@ bool rcBuildPolyMesh(rcContourSet& cset, int nvp, rcPolyMesh& mesh) rcGetLog()->log(RC_LOG_ERROR, "rcBuildPolyMesh: Failed to remove edge vertex %d.", i); return false; } - for (int j = i; j < mesh.nverts-1; ++j) + // Note: mesh.nverts is already decremented inside removeVertex()! + for (int j = i; j < mesh.nverts; ++j) vflags[j] = vflags[j+1]; --i; }