Module: libav
Branch: master
Commit: d02202e08a994c6c80f0256ae756698541b59902

Author:    Justin Ruggles <[email protected]>
Committer: Justin Ruggles <[email protected]>
Date:      Thu Nov  8 18:35:49 2012 -0500

opt: avoid segfault in av_opt_next() if the class does not have an option list

CC: [email protected]

---

 libavutil/opt.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index e199170..8a98a9e 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -37,8 +37,10 @@
 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;
 }
 

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to