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 committed by Philipp Oeser
parent b3e0eadbdc
commit 77e66d630a
Notes: blender-bot 2023-02-14 06:17:14 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
1 changed files with 7 additions and 0 deletions

View File

@ -483,10 +483,17 @@ static void gpencil_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
tgpil = MEM_callocN(sizeof(tGPDinterpolate_layer), "GPencil Interpolate Layer");
tgpil->gpl = gpl;
bGPDframe *gpf = gpencil_get_previous_keyframe(gpl, scene->r.cfra);
if (gpf == NULL) {
continue;
}
tgpil->prevFrame = BKE_gpencil_frame_duplicate(gpf, true);
gpf = gpencil_get_next_keyframe(gpl, scene->r.cfra);
if (gpf == NULL) {
continue;
}
tgpil->nextFrame = BKE_gpencil_frame_duplicate(gpf, true);
BLI_addtail(&tgpi->ilayers, tgpil);