From d4cdae29c10768ec23c13aa585978dfeaf55baa6 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 20 May 2022 10:10:46 +0200 Subject: Fix T98266: Crash with empty mesh boolean node The output mesh can be null. Also reorganize the WITH_GMP check to avoid compiling the rest of the node with GMP off. --- source/blender/nodes/geometry/nodes/node_geo_boolean.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc index df2be8e7d37..e485172d3e1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc @@ -56,15 +56,11 @@ static void node_init(bNodeTree *UNUSED(tree), bNode *node) static void node_geo_exec(GeoNodeExecParams params) { +#ifdef WITH_GMP GeometryNodeBooleanOperation operation = (GeometryNodeBooleanOperation)params.node().custom1; const bool use_self = params.get_input("Self Intersection"); const bool hole_tolerant = params.get_input("Hole Tolerant"); -#ifndef WITH_GMP - params.error_message_add(NodeWarningType::Error, - TIP_("Disabled, Blender was compiled without GMP")); -#endif - Vector meshes; Vector transforms; @@ -132,6 +128,10 @@ static void node_geo_exec(GeoNodeExecParams params) use_self, hole_tolerant, operation); + if (!result) { + params.set_default_remaining_outputs(); + return; + } MEM_SAFE_FREE(result->mat); result->mat = (Material **)MEM_malloc_arrayN(materials.size(), sizeof(Material *), __func__); @@ -139,6 +139,11 @@ static void node_geo_exec(GeoNodeExecParams params) MutableSpan(result->mat, result->totcol).copy_from(materials); params.set_output("Mesh", GeometrySet::create_with_mesh(result)); +#else + params.error_message_add(NodeWarningType::Error, + TIP_("Disabled, Blender was compiled without GMP")); + params.set_default_remaining_outputs(); +#endif } } // namespace blender::nodes::node_geo_boolean_cc -- cgit v1.2.3