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:
authorHans Goudey <h.goudey@me.com>2022-06-22 17:06:29 +0300
committerHans Goudey <h.goudey@me.com>2022-06-24 23:58:45 +0300
commit3a5fbf112a0d08a55b9a18928a3d1f318720c285 (patch)
treea18720ff5f07bdfdda923c862e977d7bfa82b999
parent0357dbf148dcbfcf6c35a5e9e34cdfa272dc7a98 (diff)
Fix T98956: Crash removing some builtin attributes
An alternative to the solution in cebc5531e944 that avoids using the CustomData_free_layer_named function that wasn't added to 3.2 yet.
-rw-r--r--source/blender/blenkernel/intern/attribute_access.cc6
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) {