Fix T97831: Curve to mesh node can create invalid wire mesh

When the profile only has one control point, its segment count was
determined incorrectly. There needs to be a special case for a single
control point, when there are no segments even if the curve is cyclic.
This commit is contained in:
Hans Goudey 2022-05-04 12:26:59 +02:00
parent 79e94caa6b
commit 302584bd6e
Notes: blender-bot 2023-02-14 02:45:41 +01:00
Referenced by issue #97831, Crash Geometry Nodes (delete geometry & curve to mesh)
1 changed files with 1 additions and 1 deletions

View File

@ -412,7 +412,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;
return (cyclic && points_num > 1) ? points_num : points_num - 1;
}
inline float2 encode_surface_bary_coord(const float3 &v)