[Bf-blender-cvs] [d12f0d3f703] master: Fix: Crash with empty vertex group in mask modifier

Hans Goudey noreply at git.blender.org
Fri Sep 23 19:32:16 CEST 2022


Commit: d12f0d3f70322ef01eef6e8ec72f7fbaf5a191ba
Author: Hans Goudey
Date:   Fri Sep 23 12:31:55 2022 -0500
Branches: master
https://developer.blender.org/rBd12f0d3f70322ef01eef6e8ec72f7fbaf5a191ba

Fix: Crash with empty vertex group in mask modifier

The C++ vertex group data accessor returned a span with null data that
wasn't empty. Instead of adding a null check as well as the size check,
just return an empty span when there is no vertex group data.

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

M	source/blender/blenkernel/BKE_mesh.h

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

diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index c1f4d9733aa..de89abf9cf6 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -1139,7 +1139,11 @@ inline blender::MutableSpan<MLoop> Mesh::loops_for_write()
 
 inline blender::Span<MDeformVert> Mesh::deform_verts() const
 {
-  return {BKE_mesh_deform_verts(this), this->totvert};
+  const MDeformVert *dverts = BKE_mesh_deform_verts(this);
+  if (!dverts) {
+    return {};
+  }
+  return {dverts, this->totvert};
 }
 inline blender::MutableSpan<MDeformVert> Mesh::deform_verts_for_write()
 {



More information about the Bf-blender-cvs mailing list