Fix #118225 possible crash double clicking on certain anim channels
The intend in the report was to rename a linked object in the NLA channels. The operator to rename actually does everything right, it detects that the object is linked and passes through to other operators. The crash then happens in the attempt to select keyframes of channels (also doubleclick n the keymap) -- in `select_anim_channel_keys`. The problem is that `bAnimListElem` `key_data` cannot be expected to be an `FCurve` in all cases. Code does though, it always casts, but this is unreliable, basically this would fail for all of the "summary" channels or any channel type (e.g. mask layers etc.), either it is NULL or garbage data. So to resolve, we just check the `bAnimListElem` type -- if it is not ALE_FCURVE we can early out (preventing the crash). NOTE: this changes behavior of double clicking on a summary channel that cannot be renamed slightly in that it will not deselect its keys anymore (it was not selecting any keys anyways, this is actually more in line of what would happen if you just select another channel -- this also leaves key selection alone -- so this is actually an improvement as well imho) Pull Request: https://projects.blender.org/blender/blender/pulls/118251
This commit is contained in:
committed by
Philipp Oeser
parent
10682abc56
commit
1a2edde400
@@ -4029,6 +4029,12 @@ static bool select_anim_channel_keys(bAnimContext *ac, int channel_index, bool e
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Only FCuves can have their keys selected. */
|
||||
if (ale->datatype != ALE_FCURVE) {
|
||||
ANIM_animdata_freelist(&anim_data);
|
||||
return false;
|
||||
}
|
||||
|
||||
fcu = (FCurve *)ale->key_data;
|
||||
success = (fcu != nullptr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user