From 6b88fc9e3ab142b886797b078125d2a0304030ab Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 27 Feb 2018 08:25:14 -0500 Subject: [PATCH] avoid segfault when an encoder could not be opened closes #473 Change-Id: Ie800c3682be58ab93178bceb9e952f26cb0d0e25 --- lib/codeclib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/codeclib.c b/lib/codeclib.c index e286be23d..ac1557b5d 100644 --- a/lib/codeclib.c +++ b/lib/codeclib.c @@ -1006,6 +1006,9 @@ static int avc_encoder_input(encoder_t *enc, AVFrame **frame) { int keep_going = 0; int got_packet = 0; + if (!enc->u.avc.avcctx) + return -1; + #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 36, 0) if (*frame) { int ret = avcodec_send_frame(enc->u.avc.avcctx, *frame);