diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 8ad906a480..42e437f5d1 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -308,7 +308,7 @@ static void write_codec_attr(AVStream *st, VariantStream *vs) { if (st->codecpar->codec_id == AV_CODEC_ID_H264) { uint8_t *data = st->codecpar->extradata; - if ((data[0] | data[1] | data[2]) == 0 && data[3] == 1 && (data[4] & 0x1F) == 7) { + if (data && (data[0] | data[1] | data[2]) == 0 && data[3] == 1 && (data[4] & 0x1F) == 7) { snprintf(attr, sizeof(attr), "avc1.%02x%02x%02x", data[5], data[6], data[7]); } else {