diff options
author | Hans Goudey <h.goudey@me.com> | 2021-09-21 04:20:39 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-09-21 04:20:39 +0300 |
commit | 4472a11017a0c48f77df26d990df2016f457058d (patch) | |
tree | deb623fbc0b3b2005fbbf23bfb90a583c831c024 /source/blender/blenkernel/intern/spline_bezier.cc | |
parent | 05f3f11d553e97f27fc88b1dada9387acdb768a6 (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/spline_bezier.cc')
-rw-r--r-- | source/blender/blenkernel/intern/spline_bezier.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc index 79d2137ee84..b36d7a21669 100644 --- a/source/blender/blenkernel/intern/spline_bezier.cc +++ b/source/blender/blenkernel/intern/spline_bezier.cc @@ -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); |