From 54c36adbec05a8e120f8e962a324eed4fc8e22ed Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Mon, 4 May 2020 21:02:58 +0100 Subject: [PATCH] Check for empty vectors before trying to access a pointer to the first element in Octree::cull_convex(). --- core/math/octree.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/math/octree.h b/core/math/octree.h index 2060a61b4ba..ffb405bd0ff 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -1290,10 +1290,12 @@ void Octree::_cull_point(Octant *p_octant, const Vector3 &p_po template int Octree::cull_convex(const Vector &p_convex, T **p_result_array, int p_result_max, uint32_t p_mask) { - if (!root) + if (!root || p_convex.size() == 0) return 0; Vector convex_points = Geometry::compute_convex_mesh_points(&p_convex[0], p_convex.size()); + if (convex_points.size() == 0) + return 0; int result_count = 0; pass++;