[Bf-blender-cvs] [704d077d8fa] master: Fix: Crash when retrieving output "id" attribute

Hans Goudey noreply at git.blender.org
Wed Oct 20 20:15:43 CEST 2021


Commit: 704d077d8fa35178af97ec5d946c470dbe25dab6
Author: Hans Goudey
Date:   Wed Oct 20 13:15:37 2021 -0500
Branches: master
https://developer.blender.org/rB704d077d8fa35178af97ec5d946c470dbe25dab6

Fix: Crash when retrieving output "id" attribute

The attribute provider needs to handle the case where the data is stored
with just a data type, and the case where it is stored with a name.

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

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

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

diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index 930cabafb00..3386d346364 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -371,7 +371,14 @@ GVMutableArrayPtr BuiltinCustomDataLayerProvider::try_get_for_write(
     return {};
   }
   const int domain_size = component.attribute_domain_size(domain_);
-  void *data = CustomData_get_layer(custom_data, stored_type_);
+
+  void *data;
+  if (stored_as_named_attribute_) {
+    data = CustomData_get_layer_named(custom_data, stored_type_, name_.c_str());
+  }
+  else {
+    data = CustomData_get_layer(custom_data, stored_type_);
+  }
   if (data == nullptr) {
     return {};
   }



More information about the Bf-blender-cvs mailing list