Fix T93154: Crash adding multiple movie strips

Some when adding multiple movies at once and only some of them have
audio track, this causes crash on NULL dereference. Issue was introduced
in bdbc7e12a0 to align sound and video properly.

Check if sound is present in movie file. If it's not, don't try to align
sound with video.
This commit is contained in:
Richard Antalik 2021-11-18 01:32:06 +01:00
parent b071083496
commit d8fd575af9
Notes: blender-bot 2023-02-14 09:09:43 +01:00
Referenced by issue #93154, VSE: Crash when importing multiple movie clips that include one without audio
1 changed files with 5 additions and 2 deletions

View File

@ -678,8 +678,11 @@ static void sequencer_add_movie_multiple_strips(bContext *C,
load_data->start_frame += audio_frame_offset;
seq_sound = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data, audio_skip);
int min_startdisp = MIN2(seq_movie->startdisp, seq_sound->startdisp);
int max_enddisp = MAX2(seq_movie->enddisp, seq_sound->enddisp);
int min_startdisp = 0, max_enddisp = 0;
if (seq_sound != NULL) {
min_startdisp = MIN2(seq_movie->startdisp, seq_sound->startdisp);
max_enddisp = MAX2(seq_movie->enddisp, seq_sound->enddisp);
}
load_data->start_frame += max_enddisp - min_startdisp - audio_frame_offset;
}