From ea0d8938173e12b289243c88c6a79dc6651e6ed9 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Sun, 23 Nov 2014 00:48:17 +0100 Subject: [PATCH] lavu/opt: handle NULL obj in av_opt_next It indirectly also fixes av_opt_free for NULL objs. Signed-off-by: Lukasz Marek --- libavutil/opt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 0546a37b0f..5b26a00ead 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -50,7 +50,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; + const AVClass *class; + if (!obj) + return NULL; + class = *(const AVClass**)obj; if (!last && class && class->option && class->option[0].name) return class->option; if (last && last[1].name)