diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-11-16 15:14:16 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-11-16 15:14:16 +0100 |
| commit | bae268cb8505bcc5bf4048cfd448168ad9bb0992 (patch) | |
| tree | 9a919f7dbbd7629d1a90f5a9e30e394bbdd67443 /src/lib/ffmpeg_decoder.cc | |
| parent | b5abb07ea62e5f4708c57b6f888101d3d3434aa8 (diff) | |
Fix crash with subtitles for which we have no codec.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index c3d32bc75..6e9d671a2 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -634,9 +634,14 @@ FFmpegDecoder::process_video_frame () void FFmpegDecoder::decode_and_process_subtitle_packet (AVPacket* packet) { + auto context = subtitle_codec_context(); + if (!context) { + return; + } + int got_subtitle; AVSubtitle sub; - if (avcodec_decode_subtitle2 (subtitle_codec_context(), &sub, &got_subtitle, packet) < 0 || !got_subtitle) { + if (avcodec_decode_subtitle2(context, &sub, &got_subtitle, packet) < 0 || !got_subtitle) { return; } |
