Fix: Crash with single point bezier spline auto handles

There's no way to calculate auto or vector handles when there is
only one point, and returning early allows avoiding checking for
that case later on.
This commit is contained in:
Hans Goudey 2021-09-20 20:20:39 -05:00
parent 05f3f11d55
commit 4472a11017
1 changed files with 5 additions and 0 deletions

View File

@ -214,6 +214,11 @@ void BezierSpline::ensure_auto_handles() const
return;
}
if (this->size() == 1) {
auto_handles_dirty_ = false;
return;
}
for (const int i : IndexRange(this->size())) {
if (ELEM(HandleType::Auto, handle_types_left_[i], handle_types_right_[i])) {
const float3 prev_diff = positions_[i] - previous_position(positions_, is_cyclic_, i);