[Bf-blender-cvs] [de913516dd2] master: Fix: missing null check

Jacques Lucke noreply at git.blender.org
Thu Jul 15 11:07:50 CEST 2021


Commit: de913516dd2e15d2c81e2854cc6208ce428243bb
Author: Jacques Lucke
Date:   Thu Jul 15 11:07:41 2021 +0200
Branches: master
https://developer.blender.org/rBde913516dd2e15d2c81e2854cc6208ce428243bb

Fix: missing null check

This was a regression in rB3b6ee8cee7080af200e25e944fe30d310240e138.

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

M	source/blender/blenkernel/intern/geometry_component_mesh.cc

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

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;
     }



More information about the Bf-blender-cvs mailing list