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.
This commit is contained in:
Hans Goudey 2021-10-20 13:15:37 -05:00
parent 010e675b1b
commit 704d077d8f
1 changed files with 8 additions and 1 deletions

View File

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