Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2020-12-07 21:08:29 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-12-07 21:08:29 +0300
commit29fb12da589eeb3bbc31b81874526208b35334cb (patch)
tree9eab4220e3b4861a7f9bf3fa7172b1a816b41582 /source/blender/editors/gpencil/gpencil_convert.c
parent3e005a3214533ffa0d8533acc1e5ed3962e32ac3 (diff)
Fix T83510: Convert Gpencil to curve crash when stroke has zero points
If the stroke had zero points the pointer returned NULL. Also replaced for loop by FOREACH macro. This is a corner case of "empty" strokes without points.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_convert.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_convert.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c
index 33b02d525d5..63aa242275a 100644
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@ -1312,7 +1312,7 @@ static void gpencil_layer_to_curve(bContext *C,
Scene *scene = CTX_data_scene(C);
bGPDframe *gpf = BKE_gpencil_layer_frame_get(gpl, CFRA, GP_GETFRAME_USE_PREV);
- bGPDstroke *gps, *prev_gps = NULL;
+ bGPDstroke *prev_gps = NULL;
Object *ob;
Curve *cu;
Nurb *nu = NULL;
@@ -1353,7 +1353,10 @@ static void gpencil_layer_to_curve(bContext *C,
gtd->inittime = ((bGPDstroke *)gpf->strokes.first)->inittime;
/* add points to curve */
- for (gps = gpf->strokes.first; gps; gps = gps->next) {
+ LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+ if (gps->totpoints < 1) {
+ continue;
+ }
const bool add_start_point = (link_strokes && !(prev_gps));
const bool add_end_point = (link_strokes && !(gps->next));