Fix T86879 Boolean exact crash with dependency loop.

When boolean's Object also has a modifier that depends back on
the target Object, a crash occurred.
In a case like this, BKE_modifier_get_evaluated_mesh_from_evaluated_object
returns NULL, so just have to protect against that case.
This commit is contained in:
Howard Trickey
2021-03-31 09:35:40 -04:00
parent 23c1e48e19
commit 94079ffc7f

View File

@@ -660,6 +660,9 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd,
BLI_array_append(material_remaps, NULL);
if (bmd->flag & eBooleanModifierFlag_Object) {
mesh_operand = BKE_modifier_get_evaluated_mesh_from_evaluated_object(bmd->object, false);
if (!mesh_operand) {
return mesh;
}
BKE_mesh_wrapper_ensure_mdata(mesh_operand);
BLI_array_append(meshes, mesh_operand);
BLI_array_append(obmats, &bmd->object->obmat);
@@ -673,6 +676,9 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd,
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, ob) {
if (ob->type == OB_MESH && ob != ctx->object) {
Mesh *collection_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob, false);
if (!collection_mesh) {
continue;
}
BKE_mesh_wrapper_ensure_mdata(collection_mesh);
BLI_array_append(meshes, collection_mesh);
BLI_array_append(obmats, &ob->obmat);