Fix: GPv3: Crash rendering cyclic strokes with single point

Creating the batch cache for rendering crashes when
there is a stroke with one point that is set to cyclic.
There was a missing check for the number of points
because we're accessing the curve lengths, which
needs at least 2 points to be populated.
This commit is contained in:
Falk David
2024-04-02 15:51:14 +02:00
parent 7ed713e772
commit ca0b02aa96

View File

@@ -633,7 +633,7 @@ static void grease_pencil_geom_batch_ensure(Object &object,
cols_slice[idx]);
}
if (is_cyclic) {
if (is_cyclic && points.size() > 1) {
const int idx = points.size() + 1;
const float u_stroke = u_scale * lengths[points.size() - 1] + u_translation;
populate_point(verts_range,