From ca0b02aa96d91cd4ba7b68ce2436e10656c8a428 Mon Sep 17 00:00:00 2001 From: Falk David Date: Tue, 2 Apr 2024 15:51:14 +0200 Subject: [PATCH] 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. --- source/blender/draw/intern/draw_cache_impl_grease_pencil.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/draw/intern/draw_cache_impl_grease_pencil.cc b/source/blender/draw/intern/draw_cache_impl_grease_pencil.cc index 7b5d314427d..d998693f6b8 100644 --- a/source/blender/draw/intern/draw_cache_impl_grease_pencil.cc +++ b/source/blender/draw/intern/draw_cache_impl_grease_pencil.cc @@ -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,