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>
This commit is contained in:
parent
77e6676d3e
commit
dfb7a638e6
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user