libtwolame: prevent a NULL pointer dereference

CC: libav-stable@libav.org
Bug-Id: CID 1250330 / CID 1250335
pull/93/merge
Vittorio Giovara 10 years ago
parent 863ee8a855
commit a42d5c861f
  1. 2
      libavcodec/libtwolame.c

@ -148,8 +148,8 @@ static int twolame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
if (ret < 0) // twolame error if (ret < 0) // twolame error
return AVERROR_UNKNOWN; return AVERROR_UNKNOWN;
avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
if (frame) { if (frame) {
avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
if (frame->pts != AV_NOPTS_VALUE) if (frame->pts != AV_NOPTS_VALUE)
avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);
} else { } else {

Loading…
Cancel
Save