lavu/opt: fix crash in av_opt_next() in case the class has no options

This commit is contained in:
Stefano Sabatini 2012-08-09 11:50:58 +02:00
parent 7fd467f708
commit a6d6b8a200
1 changed files with 2 additions and 1 deletions

View File

@ -59,7 +59,8 @@ 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 && class->option && class->option[0].name)
return class->option;
if (last && last[1].name) return ++last;
return NULL;
}