[Bf-blender-cvs] [d4cdae29c10] blender-v3.2-release: Fix T98266: Crash with empty mesh boolean node

Hans Goudey noreply at git.blender.org
Fri May 20 10:10:54 CEST 2022


Commit: d4cdae29c10768ec23c13aa585978dfeaf55baa6
Author: Hans Goudey
Date:   Fri May 20 10:10:46 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rBd4cdae29c10768ec23c13aa585978dfeaf55baa6

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.

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_boolean.cc

===================================================================

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



More information about the Bf-blender-cvs mailing list