lavu/opt: fix crash in av_opt_next() in case the class has no options
authorStefano Sabatini <stefasab@gmail.com>
Thu, 9 Aug 2012 09:50:58 +0000 (11:50 +0200)
committerStefano Sabatini <stefasab@gmail.com>
Fri, 10 Aug 2012 21:14:37 +0000 (23:14 +0200)
libavutil/opt.c

index cdd5276..02869e4 100644 (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;
 }