From df5da16aa117df150b0887b827733f8768cebe12 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Tue, 18 Jan 2022 13:44:27 +0100 Subject: Cleanup: Avoid possible NULL pointer error In normal conditions, `gpf` always has a value, but better move inside the NULL checking. --- source/blender/editors/gpencil/editaction_gpencil.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index eb51527db5c..86d02e8937c 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -476,9 +476,10 @@ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode) /* get frame to copy data into (if no frame returned, then just ignore) */ gpf = BKE_gpencil_layer_frame_get(gpld, gpfs->framenum, GP_GETFRAME_ADD_NEW); - /* Ensure to use same keyframe type. */ - gpf->key_type = gpfs->key_type; if (gpf) { + /* Ensure to use same keyframe type. */ + gpf->key_type = gpfs->key_type; + bGPDstroke *gps, *gpsn; /* This should be the right frame... as it may be a pre-existing frame, -- cgit v1.2.3