Skip to content

Commit 2715c7d

Browse files
authored
Fixed crash playing drag cutscene (#3845)
The drag FMV happens to have no audio stream. This wasn't properly handled and causes a crash.
1 parent ad1fafb commit 2715c7d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/bflib_fmvids.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,9 @@ struct movie_t {
296296
setup_video();
297297
make_packet();
298298
make_frame();
299-
make_resampler();
299+
if (m_audio_context) {
300+
make_resampler();
301+
}
300302
m_time_base = m_format_context->streams[m_video_index]->time_base;
301303
}
302304

@@ -600,7 +602,7 @@ struct movie_t {
600602

601603
void play() {
602604
while (read_frame()) {
603-
if (m_packet->stream_index == m_audio_index) {
605+
if (m_packet->stream_index == m_audio_index && m_audio_context) {
604606
if (!decode_audio()) {
605607
break;
606608
}
@@ -610,7 +612,9 @@ struct movie_t {
610612
}
611613
}
612614
}
613-
flush_audio();
615+
if (m_audio_context) {
616+
flush_audio();
617+
}
614618
flush_video();
615619
}
616620
};

0 commit comments

Comments
 (0)