Fix #129333: GPv3: Crash when selecting bezier curves

Introduced by 74129b648b.
The issue was that the code didn't check if the selection attribute
exists which it might not.

Pull Request: https://projects.blender.org/blender/blender/pulls/129623
This commit is contained in:
Falk David
2024-10-31 11:48:08 +01:00
committed by Falk David
parent 7cbc94d835
commit dc80fe879b

View File

@@ -265,15 +265,17 @@ bool selection_update(const ViewContext *vc,
/* Modes that un-set all elements not in the mask. */
if (ELEM(sel_op, SEL_OP_SET, SEL_OP_AND)) {
bke::GSpanAttributeWriter selection =
curves.attributes_for_write().lookup_for_write_span(attribute_name);
ed::curves::fill_selection_false(selection.span);
if (bke::GSpanAttributeWriter selection =
curves.attributes_for_write().lookup_for_write_span(attribute_name))
{
ed::curves::fill_selection_false(selection.span);
selection.finish();
}
}
if (use_segment_selection) {
/* Range of points in tree data matching this curve, for re-using screen space
* positions.
*/
* positions. */
const IndexRange tree_data_range = tree_data_by_drawing[i_drawing];
changed |= ed::greasepencil::apply_mask_as_segment_selection(curves,
changed_element_mask,