avopt: fix segfault
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 27 May 2011 14:54:22 +0000 (16:54 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 27 May 2011 14:55:07 +0000 (16:55 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/opt.c

index 8f2d9a6..6b2bc77 100644 (file)
@@ -45,7 +45,7 @@ const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mas
 const AVOption *av_next_option(void *obj, const AVOption *last)
 {
     if (last && last[1].name) return ++last;
-    else if (last)            return NULL;
+    else if (last || !(*(AVClass**)obj)->option->name) return NULL;
     else                      return (*(AVClass**)obj)->option;
 }