diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
index ae2b4fd779d..856f7ca25cc 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc
@@ -135,9 +135,18 @@ static VArray<float> construct_curve_parameter_varray(const bke::CurvesGeometry
const int last_index = curves.curves_num() - 1;
const int total_length = lengths.last() + curves.evaluated_length_total_for_curve(
last_index, cyclic[last_index]);
- const float factor = total_length == 0.0f ? 0.0f : 1.0f / total_length;
- for (float &value : lengths) {
- value *= factor;
+
+ if (total_length != 0.0f) {
+ const float factor 1.0f / total_length;
+ for (float &value : lengths) {
+ value *= factor;
+ }
+ }
+ else {
+ for (int i = 0; i < lengths.size(); i++) {
+ float &value = lengths[i];
+ value = i / (lengths.size() - 1.0f);
+ }
}
return VArray<float>::ForContainer(std::move(lengths));
}