diff options
author | Hans Goudey <h.goudey@me.com> | 2021-05-09 09:13:06 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-05-09 09:13:06 +0300 |
commit | 7029cc2f8adf9a5882f247324c59d4c25e18c287 (patch) | |
tree | 9b784cc26124ff1f19ca73a6ca5f3bdbfa7ebae4 /source/blender/blenkernel | |
parent | 518c5ce4cd75aabcc649efb9e118d18622b5ea70 (diff) |
Fix T88126: Curve resample crash for single point input
The spline `length` function assumed that the curve always had evaluated
edges. That is clearly false. This commit adds a check to `length` and a
special case for a single point in the curve resample node.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/spline_base.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc index e2b1118a0b2..447e8a5b0a5 100644 --- a/source/blender/blenkernel/intern/spline_base.cc +++ b/source/blender/blenkernel/intern/spline_base.cc @@ -61,7 +61,8 @@ int Spline::evaluated_edges_size() const float Spline::length() const { - return this->evaluated_lengths().last(); + Span<float> lengths = this->evaluated_lengths(); + return (lengths.size() == 0) ? 0 : this->evaluated_lengths().last(); } int Spline::segments_size() const |