From cef7979c63fcfa6765606a929a5e2475d3d8dce9 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Fri, 16 Feb 2024 13:56:34 +0100 Subject: [PATCH] Fix #107228: AttributeGroup.new crash when layer cannot be created A layer cannot be created e.g. when creating a reserved-name attributes with the wrong domain/type. Caused by 101d04f41ffbb72bf20e7c2b15f1bb868328cd03 [which just did not check if the layer creation was successful]. This should go into 3.6 LTS as well. --- source/blender/makesrna/intern/rna_attribute.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/makesrna/intern/rna_attribute.cc b/source/blender/makesrna/intern/rna_attribute.cc index e4466e406e0..1c222206710 100644 --- a/source/blender/makesrna/intern/rna_attribute.cc +++ b/source/blender/makesrna/intern/rna_attribute.cc @@ -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) { -- 2.30.2