Fix #107637: crash when using density brush on empty hair

This commit is contained in:
Jacques Lucke
2023-05-08 09:25:55 +02:00
parent 04d50f4b23
commit c3365666e5
2 changed files with 6 additions and 0 deletions

View File

@@ -338,6 +338,9 @@ Span<int> CurvesGeometry::offsets() const
}
MutableSpan<int> CurvesGeometry::offsets_for_write()
{
if (this->curve_num == 0) {
return {};
}
implicit_sharing::make_trivial_data_mutable(
&this->curve_offsets, &this->runtime->curve_offsets_sharing_info, this->curve_num + 1);
return {this->curve_offsets, this->curve_num + 1};

View File

@@ -278,6 +278,9 @@ AddCurvesOnMeshOutputs add_curves_on_mesh(CurvesGeometry &curves,
/* Grow number of curves first, so that the offsets array can be filled. */
curves.resize(old_points_num, new_curves_num);
if (new_curves_num == 0) {
return outputs;
}
const IndexRange new_curves_range = curves.curves_range().drop_front(old_curves_num);
/* Compute new curve offsets. */