Fix: crash trying to store an attribute on unsupported grease pencil domain

This crash happened when trying to store an attribute on the edge domain
on a grease pencil geometry.
This commit is contained in:
Jacques Lucke
2024-01-16 16:19:28 +01:00
parent 6a35c8c99e
commit 766c1e2f8d

View File

@@ -766,7 +766,8 @@ bool try_capture_field_on_geometry(GeometryComponent &component,
const fn::Field<bool> &selection,
const fn::GField &field)
{
if (component.type() == GeometryComponent::Type::GreasePencil &&
const GeometryComponent::Type component_type = component.type();
if (component_type == GeometryComponent::Type::GreasePencil &&
ELEM(domain, AttrDomain::Point, AttrDomain::Curve))
{
/* Capture the field on every layer individually. */
@@ -798,6 +799,10 @@ bool try_capture_field_on_geometry(GeometryComponent &component,
});
return any_success;
}
if (component_type == GeometryComponent::Type::GreasePencil && domain != AttrDomain::Layer) {
/* The remaining code only handles the layer domain for grease pencil geometries. */
return false;
}
MutableAttributeAccessor attributes = *component.attributes_for_write();
const GeometryFieldContext field_context{component, domain};