diff options
author | Martin Storsjö | 2013-07-29 14:53:01 +0300 |
---|---|---|
committer | Martin Storsjö | 2013-07-31 21:31:14 +0300 |
commit | c7e921a54ffe7feb9f695c82f0a0764ab8d0f62b (patch) | |
tree | fb2b89fb5d1f9eb95823596002b0b688d0b00292 /libavutil/opt.c | |
parent | b7e6da988bfd5def40ccf3476eb8ce2f98a969a5 (diff) |
avopt: Check whether the object actually has got an AVClass
AVIOContext has got an av_class member that only gets set if
opening the context using avio_open2, but not if allocating a
custom IO context. A caller that wants to read AVOptions from
an AVIOContext (recursively using AV_OPT_SEARCH_CHILDREN) may
not know if the AVIOContext actually has got a class set or not.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r-- | libavutil/opt.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c index f2b947337e..cba5b29ac6 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -650,6 +650,9 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, const AVClass *c = *(AVClass**)obj; const AVOption *o = NULL; + if (!c) + return NULL; + if (search_flags & AV_OPT_SEARCH_CHILDREN) { if (search_flags & AV_OPT_SEARCH_FAKE_OBJ) { const AVClass *child = NULL; |