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.
This commit is contained in:
Antonio Vazquez 2022-12-07 17:23:30 +01:00
parent d384ad38bc
commit 0361afb165
Notes: blender-bot 2023-02-13 13:22:20 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
1 changed files with 6 additions and 0 deletions

View File

@ -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);