Fix #107228: AttributeGroup.new crash when layer cannot be created #118378

Merged
Philipp Oeser merged 1 commits from lichtwerk/blender:107228 into blender-v4.1-release 2024-02-16 15:36:40 +01:00
1 changed files with 4 additions and 0 deletions

View File

@ -399,6 +399,10 @@ static PointerRNA rna_AttributeGroup_new(
CustomDataLayer *layer = BKE_id_attribute_new(
id, name, eCustomDataType(type), AttrDomain(domain), reports);
if (!layer) {
return PointerRNA_NULL;
}
if ((GS(id->name) == ID_ME) && ELEM(layer->type, CD_PROP_COLOR, CD_PROP_BYTE_COLOR)) {
Mesh *mesh = (Mesh *)id;
if (!mesh->active_color_attribute) {