From 7084f3dc33d7771dfa967700caa73822288307a0 Mon Sep 17 00:00:00 2001 From: Rafael Traista Date: Thu, 25 Apr 2024 19:07:16 +0300 Subject: [PATCH] Fix crash caused by fixed size collection. In some cases this variables will be accessed by Plane.SplitPolygon and at this line it will crash, because the Collection is fixed size, so cannot Add() (_normal.Dot(polygon.Plane._normal) > 0 ? coplanarFront : coplanarBack).Add(polygon) --- CSG.Sharp.Lib/Primitives/Node.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CSG.Sharp.Lib/Primitives/Node.cs b/CSG.Sharp.Lib/Primitives/Node.cs index d6dc319..fc682ce 100644 --- a/CSG.Sharp.Lib/Primitives/Node.cs +++ b/CSG.Sharp.Lib/Primitives/Node.cs @@ -71,7 +71,7 @@ public IList ClipPolygons(IList polygons) if (_back != null) back = _back.ClipPolygons(back).ToList(); else back = Enumerable.Empty().ToList(); - return front.Concat(back).ToArray(); + return front.Concat(back).ToList(); } // Remove all polygons in this BSP tree that are inside the other BSP tree @@ -118,4 +118,4 @@ public void Build(IList polygons) } } } -} \ No newline at end of file +}