Fix T94082: Curve to point empty evaluated NURBS crash

This is basically the same as rBee4ed99866fbb7ab04, the fix is
simply to check if the spline has evaluated points when deciding
the offsets into the result points array.
This commit is contained in:
Hans Goudey 2021-12-14 18:57:45 -06:00 committed by Philipp Oeser
parent b9f5e6c0b4
commit 0a6b6eb13b
Notes: blender-bot 2023-02-14 06:05:22 +01:00
Referenced by issue #94082, Crash on changing curve type from Bezier to NURBS in Geometry Nodes
Referenced by issue #93479, 3.0 Potential candidates for corrective releases
1 changed files with 10 additions and 3 deletions

View File

@ -78,9 +78,14 @@ static Array<int> calculate_spline_point_offsets(GeoNodeExecParams &params,
return {0};
}
Array<int> offsets(size + 1);
for (const int i : offsets.index_range()) {
offsets[i] = count * i;
int offset = 0;
for (const int i : IndexRange(size)) {
offsets[i] = offset;
if (splines[i]->evaluated_points_size() > 0) {
offset += count;
}
}
offsets.last() = offset;
return offsets;
}
case GEO_NODE_CURVE_RESAMPLE_LENGTH: {
@ -90,7 +95,9 @@ static Array<int> calculate_spline_point_offsets(GeoNodeExecParams &params,
int offset = 0;
for (const int i : IndexRange(size)) {
offsets[i] = offset;
offset += splines[i]->length() / resolution + 1;
if (splines[i]->evaluated_points_size() > 0) {
offset += splines[i]->length() / resolution + 1;
}
}
offsets.last() = offset;
return offsets;