diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/attribute_access.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc index d33b64c493b..0f104fa9c9e 100644 --- a/source/blender/blenkernel/intern/attribute_access.cc +++ b/source/blender/blenkernel/intern/attribute_access.cc @@ -367,7 +367,7 @@ bool BuiltinCustomDataLayerProvider::try_delete(GeometryComponent &component) co } const int domain_size = component.attribute_domain_size(domain_); - int layer_index; + int layer_index = -1; if (stored_as_named_attribute_) { for (const int i : IndexRange(custom_data->totlayer)) { if (custom_data_layer_matches_attribute_id(custom_data->layers[i], name_)) { @@ -380,6 +380,10 @@ bool BuiltinCustomDataLayerProvider::try_delete(GeometryComponent &component) co layer_index = CustomData_get_layer_index(custom_data, stored_type_); } + if (layer_index == -1) { + return false; + } + const bool delete_success = CustomData_free_layer( custom_data, stored_type_, domain_size, layer_index); if (delete_success) { |