Browse Source

Fix for assert in VS2015 debug builds (and likely others too). ( Expression: vector subscript out of range )

Srekel 10 years ago
parent
commit
7375b97688
1 changed files with 1 additions and 1 deletions
  1. 1 1
      3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp

+ 1 - 1
3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp

@@ -293,7 +293,7 @@ namespace Forsyth
 
 
                 assert(vertexData.activeFaceListSize > 0);
                 assert(vertexData.activeFaceListSize > 0);
                 uint* begin = &activeFaceList[vertexData.activeFaceListStart];
                 uint* begin = &activeFaceList[vertexData.activeFaceListStart];
-                uint* end = &activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize];
+				uint* end = &(activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize - 1]) + 1;
                 uint* it = std::find(begin, end, bestFace);
                 uint* it = std::find(begin, end, bestFace);
                 assert(it != end);
                 assert(it != end);
                 std::swap(*it, *(end-1));
                 std::swap(*it, *(end-1));