[Bf-blender-cvs] [0361afb1652] master: GPencil: Fix unreported interpolate crash if no frames

Antonio Vazquez noreply at git.blender.org
Wed Dec 7 17:23:57 CET 2022


Commit: 0361afb1652ea64ee04e8efb4a08a96d9f3f9f8e
Author: Antonio Vazquez
Date:   Wed Dec 7 17:23:30 2022 +0100
Branches: master
https://developer.blender.org/rB0361afb1652ea64ee04e8efb4a08a96d9f3f9f8e

GPencil: Fix unreported interpolate crash if no frames

If there is a layer that hasn't frames but is not the active layer
the pointer to frames can be NULL and crash.

Now, the empty layers are skipped.

Reported to me by Samuel Bernou.

===================================================================

M	source/blender/editors/gpencil/gpencil_interpolate.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index baf2919fd60..d4d072d7580 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -491,9 +491,15 @@ static void gpencil_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
 
     tgpil->gpl = gpl;
     bGPDframe *gpf = gpencil_get_previous_keyframe(gpl, scene->r.cfra, exclude_breakdowns);
+    if (gpf == NULL) {
+      continue;
+    }
     tgpil->prevFrame = BKE_gpencil_frame_duplicate(gpf, true);
 
     gpf = gpencil_get_next_keyframe(gpl, scene->r.cfra, exclude_breakdowns);
+    if (gpf == NULL) {
+      continue;
+    }
     tgpil->nextFrame = BKE_gpencil_frame_duplicate(gpf, true);
 
     BLI_addtail(&tgpi->ilayers, tgpil);



More information about the Bf-blender-cvs mailing list