diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-11-10 09:19:09 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-11-11 08:27:16 +0100 |
commit | e1e22851c15b2b88de111353f53fe4c94431f883 (patch) | |
tree | aff80825bd9d3919aa05682ecdb470de73a0abb2 /libavutil/opt.c | |
parent | 45fcb86cf86a0dca43a196e927817efb188fd7da (diff) | |
download | ffmpeg-e1e22851c15b2b88de111353f53fe4c94431f883.tar.gz |
AVOptions: don't return an invalid option when option list is empty
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r-- | libavutil/opt.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c index aa76301740..7c53024d25 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -56,9 +56,10 @@ const AVOption *av_next_option(void *obj, const AVOption *last) const AVOption *av_opt_next(void *obj, const AVOption *last) { - if (last && last[1].name) return ++last; - else if (last) return NULL; - else return (*(AVClass**)obj)->option; + AVClass *class = *(AVClass**)obj; + if (!last && class->option[0].name) return class->option; + if (last && last[1].name) return ++last; + return NULL; } static int read_number(const AVOption *o, void *dst, double *num, int *den, int64_t *intnum) |