From e0e45e013e477ab55641a1b52aa24f219daf0e98 Mon Sep 17 00:00:00 2001 From: Ricardo Buring Date: Wed, 21 Dec 2022 17:08:24 +0100 Subject: [PATCH] Fix edge map capacity in convex hull computer The desired capacity could be less than the default, so reserve would error. --- core/math/convex_hull.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/math/convex_hull.cpp b/core/math/convex_hull.cpp index 561970d2eef..51d88d8ea04 100644 --- a/core/math/convex_hull.cpp +++ b/core/math/convex_hull.cpp @@ -2274,8 +2274,7 @@ Error ConvexHullComputer::convex_hull(const Vector &p_points, Geometry3 // Copy the edges over. There's two "half-edges" for every edge, so we pick only one of them. r_mesh.edges.resize(ch.edges.size() / 2); - OAHashMap edge_map; - edge_map.reserve(ch.edges.size() * 4); // The higher the capacity, the faster the insert + OAHashMap edge_map(ch.edges.size() * 4); // The higher the capacity, the faster the insert uint32_t edges_copied = 0; for (uint32_t i = 0; i < ch.edges.size(); i++) {