From 79d60a7d5ec3e7a978887dc358b169bce7fd4bce Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 21 Feb 2014 09:51:34 +0000 Subject: Small cleanup. --- src/lib/ffmpeg_decoder.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index c3709166e..587c79495 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -516,15 +516,19 @@ FFmpegDecoder::setup_subtitle () { boost::mutex::scoped_lock lm (_mutex); - if (!_ffmpeg_content->subtitle_stream() || _ffmpeg_content->subtitle_stream()->index (_format_context) >= int (_format_context->nb_streams)) { + if (!_ffmpeg_content->subtitle_stream()) { return; } _subtitle_codec_context = _ffmpeg_content->subtitle_stream()->stream(_format_context)->codec; + if (_subtitle_codec_context == 0) { + throw DecodeError (N_("could not find subtitle stream")); + } + _subtitle_codec = avcodec_find_decoder (_subtitle_codec_context->codec_id); if (_subtitle_codec == 0) { - throw DecodeError (_("could not find subtitle decoder")); + throw DecodeError (N_("could not find subtitle decoder")); } if (avcodec_open2 (_subtitle_codec_context, _subtitle_codec, 0) < 0) { -- cgit v1.2.3