diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-20 11:10:46 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-20 11:10:46 +0300 |
commit | d4cdae29c10768ec23c13aa585978dfeaf55baa6 (patch) | |
tree | 7b2a639e885296e353b747931b464d1dbbca5176 /source/blender | |
parent | b8bd20d7e0238df9a7f558892377f6b304d5ca75 (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_boolean.cc | 15 |
1 files changed, 10 insertions, 5 deletions
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<bool>("Self Intersection"); const bool hole_tolerant = params.get_input<bool>("Hole Tolerant"); -#ifndef WITH_GMP - params.error_message_add(NodeWarningType::Error, - TIP_("Disabled, Blender was compiled without GMP")); -#endif - Vector<const Mesh *> meshes; Vector<const float4x4 *> 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 |