Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-07-15 12:07:41 +0300
committerJacques Lucke <jacques@blender.org>2021-07-15 12:07:41 +0300
commitde913516dd2e15d2c81e2854cc6208ce428243bb (patch)
tree737309bb1199b54d261dd6bd85ef421c346d208b /source/blender/blenkernel/intern/geometry_component_mesh.cc
parentc27ef1e9e8e663e02173e518c1e669e9845b3d1f (diff)
Fix: missing null check
This was a regression in rB3b6ee8cee7080af200e25e944fe30d310240e138.
Diffstat (limited to 'source/blender/blenkernel/intern/geometry_component_mesh.cc')
-rw-r--r--source/blender/blenkernel/intern/geometry_component_mesh.cc11
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;
}