Fix T39424: VSE: Bake Sound to Curve CRASHES Blender

BKE_sequencer_offset_animdata() was simply assuming bezt member of fcurve was always valid, while it might be NULL (e.g. when fcurve is using FPoints instead, like when generated from sound file).
This commit is contained in:
Bastien Montagne 2014-03-26 20:01:09 +01:00
parent cc6b106d34
commit fd3de8b042
Notes: blender-bot 2023-02-14 10:54:27 +01:00
Referenced by issue #39424, VSE: Bake Sound to Curve CRASHES Blender
1 changed files with 13 additions and 5 deletions

View File

@ -4034,11 +4034,19 @@ void BKE_sequencer_offset_animdata(Scene *scene, Sequence *seq, int ofs)
for (fcu = scene->adt->action->curves.first; fcu; fcu = fcu->next) {
if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
unsigned int i;
for (i = 0; i < fcu->totvert; i++) {
BezTriple *bezt = &fcu->bezt[i];
bezt->vec[0][0] += ofs;
bezt->vec[1][0] += ofs;
bezt->vec[2][0] += ofs;
if (fcu->bezt) {
for (i = 0; i < fcu->totvert; i++) {
BezTriple *bezt = &fcu->bezt[i];
bezt->vec[0][0] += ofs;
bezt->vec[1][0] += ofs;
bezt->vec[2][0] += ofs;
}
}
if (fcu->fpt) {
for (i = 0; i < fcu->totvert; i++) {
FPoint *fpt = &fcu->fpt[i];
fpt->vec[0] += ofs;
}
}
}
}