Fix #107637: crash when using density brush on empty hair
This commit is contained in:
@@ -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};
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user