Fix T74837: GPencil: Mirror over first selected marker crashes

'mirror_gpf_marker()' needs a NULL bGPDframe for initialization [but
still requires a scene to get the marker].

Maniphest Tasks: T74837

Differential Revision: https://developer.blender.org/D7166
This commit is contained in:
Philipp Oeser 2020-03-17 18:58:06 +01:00
parent a12ae67cf7
commit 1935cd4027
Notes: blender-bot 2023-02-13 23:09:16 +01:00
Referenced by issue #74837, GPencil: Mirror over first selected marker causing blender crash
1 changed files with 4 additions and 4 deletions

View File

@ -612,13 +612,13 @@ static short mirror_gpf_marker(bGPDframe *gpf, Scene *scene)
/* In order for this mirror function to work without
* any extra arguments being added, we use the case
* of bezt==NULL to denote that we should find the
* of gpf==NULL to denote that we should find the
* marker to mirror over. The static pointer is safe
* to use this way, as it will be set to null after
* each cycle in which this is called.
*/
if (gpf) {
if (gpf != NULL) {
/* mirroring time */
if ((gpf->flag & GP_FRAME_SELECT) && (marker)) {
diff = (marker->frame - gpf->framenum);
@ -659,9 +659,9 @@ void ED_gplayer_mirror_frames(bGPDlayer *gpl, Scene *scene, short mode)
ED_gplayer_frames_looper(gpl, scene, mirror_gpf_xaxis);
break;
case MIRROR_KEYS_MARKER: /* mirror over marker */
mirror_gpf_marker(NULL, NULL);
mirror_gpf_marker(NULL, scene);
ED_gplayer_frames_looper(gpl, scene, mirror_gpf_marker);
mirror_gpf_marker(NULL, NULL);
mirror_gpf_marker(NULL, scene);
break;
default: /* just in case */
ED_gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis);