Fix T88262: Curve to mesh crash with vector last segment

The code incorrectly used the size of the second to last segment rather
than the last segment's size. That was a problem when the last segment
is a vector segment but the second to last isn't.

I also used the opportunity to slightly refactor the control point
offsets cache, making it one longer so it also contains information
about the size of the last segment, simplifying other code.
This commit is contained in:
2021-05-14 11:26:42 -05:00
parent 7178e54122
commit db59f0b943
2 changed files with 24 additions and 24 deletions

View File

@@ -198,7 +198,7 @@ static void spline_extrude_to_mesh_data(const Spline &spline,
if (profile_spline.type() == Spline::Type::Bezier) {
const BezierSpline &bezier_spline = static_cast<const BezierSpline &>(profile_spline);
Span<int> control_point_offsets = bezier_spline.control_point_offsets();
for (const int i : control_point_offsets.index_range()) {
for (const int i : IndexRange(bezier_spline.size())) {
if (bezier_spline.point_is_sharp(i)) {
mark_edges_sharp(r_edges.slice(
spline_edges_start + spline_edge_len * control_point_offsets[i], spline_edge_len));