aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-04 18:58:38 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-04 19:08:32 +0100
commit3bcd1daad7993d2d23704582260fe45f4823a16d (patch)
treecf52ddc753132c44296874dc56e839d128d7a718
parent91f88eab32b58549393e1becc2047d4687867ce2 (diff)
downloadffmpeg-3bcd1daad7993d2d23704582260fe45f4823a16d.tar.gz
doc/examples/transcoding: check encoder before using it
Fixes null pointer exception Found-by: stoupeace Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit bde27e1e617dfeb3c026f530f48a77f5ed8aa2ea) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/examples/transcoding.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c
index 759c628e93..5572461616 100644
--- a/doc/examples/transcoding.c
+++ b/doc/examples/transcoding.c
@@ -116,6 +116,10 @@ static int open_output_file(const char *filename)
|| dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
/* in this example, we choose transcoding to same codec */
encoder = avcodec_find_encoder(dec_ctx->codec_id);
+ if (!encoder) {
+ av_log(NULL, AV_LOG_FATAL, "Neccessary encoder not found\n");
+ return AVERROR_INVALIDDATA;
+ }
/* In this example, we transcode to same properties (picture size,
* sample rate etc.). These properties can be changed for output