movenc: fix NULL reference in mov_write_tkhd_tag

st may be NULL when there are more mov streams than AVStreams, e.g. when
chapters are present.

(cherry picked from commit c92a2a4eb8b883e82871c2415f757153d263b6b3)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
This commit is contained in:
Anton Khirnov 2011-09-19 15:15:56 +02:00 committed by Reinhard Tartler
parent ad47a5ec85
commit 9f9b731a3a

View File

@ -1215,7 +1215,7 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
avio_wb32(pb, 0); /* reserved */
avio_wb32(pb, 0); /* reserved */
avio_wb16(pb, 0); /* layer */
avio_wb16(pb, st->codec->codec_type); /* alternate group) */
avio_wb16(pb, st ? st->codec->codec_type : 0); /* alternate group) */
/* Volume, only for audio */
if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
avio_wb16(pb, 0x0100);