[Bf-blender-cvs] [e1dd8d72a3e] asset-browser-poselib: Fix T89033: segfault reordering animation channels

Maxime Casas noreply at git.blender.org
Fri Jun 11 16:38:01 CEST 2021


Commit: e1dd8d72a3e080029d2eecf336f018f14529694a
Author: Maxime Casas
Date:   Fri Jun 11 16:26:01 2021 +0200
Branches: asset-browser-poselib
https://developer.blender.org/rBe1dd8d72a3e080029d2eecf336f018f14529694a

Fix T89033: segfault reordering animation channels

Fix segmentation fault that can occur when reordering animation
channels.

Under some specific conditions, the list "act->curves" is empty in the
"join_groups_action_temp" function. In particular, this happens when a
scene contains an action that has not been pushed down, and with no
keyframe in it.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11569

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

M	source/blender/editors/animation/anim_channels_edit.c

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

diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 64082b08da9..6c6fab13b7a 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -1349,10 +1349,12 @@ static void join_groups_action_temp(bAction *act)
 
   /* BLI_movelisttolist() doesn't touch first->prev and last->next pointers in its "dst" list.
    * Ensure that after the reshuffling the list is properly terminated. */
-  FCurve *act_fcurves_first = act->curves.first;
-  act_fcurves_first->prev = NULL;
-  FCurve *act_fcurves_last = act->curves.last;
-  act_fcurves_last->next = NULL;
+  if (!BLI_listbase_is_empty(&act->curves)) {
+    FCurve *act_fcurves_first = act->curves.first;
+    act_fcurves_first->prev = NULL;
+    FCurve *act_fcurves_last = act->curves.last;
+    act_fcurves_last->next = NULL;
+  }
 }
 
 /* Change the order of anim-channels within action



More information about the Bf-blender-cvs mailing list