Fix: Crash with empty curves add interpolate points

The neighbors for an added curve can be empty.
In that case use the constant value instead of interpolating.
This commit is contained in:
Hans Goudey
2022-05-11 15:40:19 +02:00
parent e354ba701a
commit 6599d2f03b

View File

@@ -608,9 +608,14 @@ struct AddOperationExecutor {
attribute_math::DefaultMixer<int> mixer{new_offsets};
threading::parallel_for(neighbors_per_curve.index_range(), 1024, [&](IndexRange curves_range) {
for (const int i : curves_range) {
for (const NeighborInfo &neighbor : neighbors_per_curve[i]) {
const int neighbor_points_num = curves_->points_for_curve(neighbor.index).size();
mixer.mix_in(i, neighbor_points_num, neighbor.weight);
if (neighbors_per_curve[i].is_empty()) {
mixer.mix_in(i, constant_points_per_curve_, 1.0f);
}
else {
for (const NeighborInfo &neighbor : neighbors_per_curve[i]) {
const int neighbor_points_num = curves_->points_for_curve(neighbor.index).size();
mixer.mix_in(i, neighbor_points_num, neighbor.weight);
}
}
}
});