diff options
author | Maxime Casas <troopy28> | 2021-06-11 17:26:01 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-06-11 17:27:04 +0300 |
commit | b4adb85933f9607ba5e1fb5a106520e44734125b (patch) | |
tree | a5f3380c6191b763954b94d7805fa8e2052ba1cf | |
parent | 605ce623be70b089a7059b03f2eb6852902136da (diff) |
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
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 10 |
1 files changed, 6 insertions, 4 deletions
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 |