Check for NULL before dereferencing fStream pointer.

Change-Id: Ic1c21b24a3a1c02b478d1e8b2e395cc8a4e7adab
This commit is contained in:
JackBurton79
2018-08-16 16:31:00 +02:00
parent 1da12a78de
commit 8d721650ce
@@ -106,13 +106,14 @@ AVFormatWriter::StreamCookie::Init(media_format* format,
fPacket.stream_index = fFormatContext->nb_streams;
fStream = avformat_new_stream(fFormatContext, NULL);
fStream->id = fPacket.stream_index;
if (fStream == NULL) {
TRACE(" failed to add new stream\n");
return B_ERROR;
}
fStream->id = fPacket.stream_index;
// TRACE(" fStream->codecpar: %p\n", fStream->codecpar);
// TODO: This is a hack for now! Use avcodec_find_encoder_by_name()
// or something similar...