diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-11-08 18:35:49 -0500 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2013-01-12 17:59:40 +0100 |
commit | dfb7a638e6b9d4b86b7e3c5cf97bdd7621adc5f6 (patch) | |
tree | 92eefcc2877887e6f760d56cfd3a609e0bdbbc22 /libavutil | |
parent | 77e6676d3eb3a5161f75103180d4ef3f3c8eb5c7 (diff) | |
download | ffmpeg-dfb7a638e6b9d4b86b7e3c5cf97bdd7621adc5f6.tar.gz |
opt: avoid segfault in av_opt_next() if the class does not have an option list
CC: libav-stable@libav.org
(cherry picked from commit d02202e08a994c6c80f0256ae756698541b59902)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/opt.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c index 7c53024d25..aea381eead 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -57,8 +57,10 @@ const AVOption *av_next_option(void *obj, const AVOption *last) const AVOption *av_opt_next(void *obj, const AVOption *last) { AVClass *class = *(AVClass**)obj; - if (!last && class->option[0].name) return class->option; - if (last && last[1].name) return ++last; + if (!last && class->option && class->option[0].name) + return class->option; + if (last && last[1].name) + return ++last; return NULL; } |