[Bf-blender-cvs] [56958cd2e7d] blender-v2.83-release: Cleanup: Avoid possible NULL pointer error

Antonio Vazquez noreply at git.blender.org
Tue Feb 22 12:18:04 CET 2022


Commit: 56958cd2e7d3942d0e8e5c6bcff5a0ca97c5ddf2
Author: Antonio Vazquez
Date:   Tue Jan 18 13:44:27 2022 +0100
Branches: blender-v2.83-release
https://developer.blender.org/rB56958cd2e7d3942d0e8e5c6bcff5a0ca97c5ddf2

Cleanup: Avoid possible NULL pointer error

In normal conditions, `gpf` always has a value, but better move inside the NULL checking.

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

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

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

diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index 4369d3ce26f..642454508ae 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -472,9 +472,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,



More information about the Bf-blender-cvs mailing list