From 873d42c88bc3aa22a53389daa1973a2aeb7d802f Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 1 Feb 2020 18:59:00 +0100 Subject: [PATCH] Mesh: [skip ci] fix crash in mesh segmentation --- src/Mod/Mesh/App/Core/Segmentation.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mod/Mesh/App/Core/Segmentation.cpp b/src/Mod/Mesh/App/Core/Segmentation.cpp index 15fa0fe18b..983d8c6da9 100644 --- a/src/Mod/Mesh/App/Core/Segmentation.cpp +++ b/src/Mod/Mesh/App/Core/Segmentation.cpp @@ -493,7 +493,10 @@ void MeshSegmentAlgorithm::FindSegments(std::vector& segm) iCur = std::find_if(iBeg, iEnd, std::bind2nd(MeshCore::MeshIsNotFlag(), MeshCore::MeshFacet::VISIT)); - startFacet = iCur - iBeg; + if (iCur < iEnd) + startFacet = iCur - iBeg; + else + startFacet = ULONG_MAX; while (startFacet != ULONG_MAX) { // collect all facets of the same geometry std::vector indices;