From 2e3a5b5be747de73dad4b1ca2f91593d524a6319 Mon Sep 17 00:00:00 2001 From: blobfish Date: Sat, 2 Mar 2024 10:13:48 +0000 Subject: [PATCH] [PATCH 3/7] BRepFill_Filling: WireFromList: We can't assume that a connected edge was found and the iterator is valid or we will crash on Edges.Remove Gbp-Pq: Name 0003-BRepFill_Filling-WireFromList-We-can-t-assume-that-a.patch --- src/BRepFill/BRepFill_Filling.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/BRepFill/BRepFill_Filling.cxx b/src/BRepFill/BRepFill_Filling.cxx index 546919e9a..9342a9dde 100644 --- a/src/BRepFill/BRepFill_Filling.cxx +++ b/src/BRepFill/BRepFill_Filling.cxx @@ -104,6 +104,7 @@ static TopoDS_Wire WireFromList(TopTools_ListOfShape& Edges) while (!Edges.IsEmpty()) { TopTools_ListIteratorOfListOfShape itl(Edges); + bool found = false; for (; itl.More(); itl.Next()) { anEdge = TopoDS::Edge(itl.Value()); @@ -126,11 +127,17 @@ static TopoDS_Wire WireFromList(TopTools_ListOfShape& Edges) anEdge.Reverse(); V2 = V3; } + found = true; break; } } - BB.Add(aWire, anEdge); - Edges.Remove(itl); + if (found) + { + BB.Add(aWire, anEdge); + Edges.Remove(itl); + } + else + break; } aWire.Closed(Standard_True); -- 2.30.2