Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-04-12 22:56:14 +0300
committerHans Goudey <h.goudey@me.com>2022-04-12 22:56:14 +0300
commit359b6baf325a701328732598ecc04b68a9a335d9 (patch)
treebef71f5c580e4a583b9b8b0706520073d3f42a3b
parentb1d915d02719427d9cf021c8fca5e9ab5f341576 (diff)
Fix: Assert when curve has no evaluated points
It is valid for NURBS curves to have no evaluated points in some cases.
-rw-r--r--source/blender/blenkernel/BKE_curves.hh4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh
index 9fd023edcf2..9dafe2095e7 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -377,6 +377,7 @@ namespace curves {
*/
inline int curve_segment_size(const int points_num, const bool cyclic)
{
+ BLI_assert(points_num > 0);
return cyclic ? points_num : points_num - 1;
}
@@ -681,8 +682,7 @@ inline IndexRange CurvesGeometry::lengths_range_for_curve(const int curve_index,
BLI_assert(cyclic == this->cyclic()[curve_index]);
const IndexRange points = this->evaluated_points_for_curve(curve_index);
const int start = points.start() + curve_index;
- const int size = curves::curve_segment_size(points.size(), cyclic);
- return {start, size};
+ return {start, points.is_empty() ? 0 : curves::curve_segment_size(points.size(), cyclic)};
}
inline Span<float> CurvesGeometry::evaluated_lengths_for_curve(const int curve_index,