diff options
author | Jacques Lucke <jacques@blender.org> | 2021-07-15 12:07:41 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-07-15 12:07:41 +0300 |
commit | de913516dd2e15d2c81e2854cc6208ce428243bb (patch) | |
tree | 737309bb1199b54d261dd6bd85ef421c346d208b /source/blender/blenkernel | |
parent | c27ef1e9e8e663e02173e518c1e669e9845b3d1f (diff) |
Fix: missing null check
This was a regression in rB3b6ee8cee7080af200e25e944fe30d310240e138.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/geometry_component_mesh.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc index af500ab3427..ef93a3f9b3f 100644 --- a/source/blender/blenkernel/intern/geometry_component_mesh.cc +++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc @@ -823,12 +823,15 @@ class VertexGroupsAttributeProvider final : public DynamicAttributesProvider { BLI_assert(component.type() == GEO_COMPONENT_TYPE_MESH); const MeshComponent &mesh_component = static_cast<const MeshComponent &>(component); const Mesh *mesh = mesh_component.get_for_read(); + if (mesh == nullptr) { + return {}; + } const int vertex_group_index = BLI_findstringindex( &mesh->vertex_group_names, attribute_name.data(), offsetof(bDeformGroup, name)); if (vertex_group_index < 0) { return {}; } - if (mesh == nullptr || mesh->dvert == nullptr) { + if (mesh->dvert == nullptr) { static const float default_value = 0.0f; return {std::make_unique<fn::GVArray_For_SingleValueRef>( CPPType::get<float>(), mesh->totvert, &default_value), @@ -874,15 +877,15 @@ class VertexGroupsAttributeProvider final : public DynamicAttributesProvider { BLI_assert(component.type() == GEO_COMPONENT_TYPE_MESH); MeshComponent &mesh_component = static_cast<MeshComponent &>(component); Mesh *mesh = mesh_component.get_for_write(); + if (mesh == nullptr) { + return true; + } const int vertex_group_index = BLI_findstringindex( &mesh->vertex_group_names, attribute_name.data(), offsetof(bDeformGroup, name)); if (vertex_group_index < 0) { return false; } - if (mesh == nullptr) { - return true; - } if (mesh->dvert == nullptr) { return true; } |