Fix T82265: GPencil interpolate crash when next frame was NULL

If the next frame of the layer was NULL and it was not the active layer crashed.
This commit is contained in:
Antonio Vazquez 2020-10-31 09:24:43 +01:00
parent 8b806c86e1
commit 9af6c041e8
Notes: blender-bot 2023-02-14 06:21:59 +01:00
Referenced by issue #82265, Crash on grease pencil interpolate all layers
1 changed files with 6 additions and 1 deletions

View File

@ -235,7 +235,9 @@ static bool gpencil_interpolate_check_todo(bContext *C, bGPdata *gpd)
/* get final stroke to interpolate */
fFrame = BLI_findindex(&gpl->actframe->strokes, gps_from);
gps_to = BLI_findlink(&gpl->actframe->next->strokes, fFrame);
gps_to = (gpl->actframe->next != NULL) ?
BLI_findlink(&gpl->actframe->next->strokes, fFrame) :
NULL;
if (gps_to == NULL) {
continue;
}
@ -273,6 +275,9 @@ static void gpencil_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
if (!BKE_gpencil_layer_is_editable(gpl) || (gpl->actframe == NULL)) {
continue;
}
if ((gpl->actframe == NULL) || (gpl->actframe->next == NULL)) {
continue;
}
/* create temp data for each layer */
tgpil = MEM_callocN(sizeof(tGPDinterpolate_layer), "GPencil Interpolate Layer");