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
This commit is contained in:
Maxime Casas 2021-06-11 16:26:01 +02:00 committed by Sybren A. Stüvel
parent 605ce623be
commit b4adb85933
Notes: blender-bot 2023-06-12 00:52:52 +02:00
Referenced by issue #89033, Segmentation fault when reordering animation channels
1 changed files with 6 additions and 4 deletions

View File

@ -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