diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 36503f3d19..7607f959e6 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2122,6 +2122,10 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) } mxf->edit_units_count++; } else if (!mxf->edit_unit_byte_count && st->index == 1) { + if (!mxf->edit_units_count) { + av_log(s, AV_LOG_ERROR, "No packets in first stream\n"); + return AVERROR_PATCHWELCOME; + } mxf->index_entries[mxf->edit_units_count-1].slice_offset = mxf->body_offset - mxf->index_entries[mxf->edit_units_count-1].offset; }