From e3e565c194580c0601568528b9bd2033ae0e6f70 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Tue, 29 Apr 2014 08:00:52 -0700 Subject: vf-metadata: fix handling of NULL metadata lavfi would segfault due to a NULL dereference if it was asked for its metadata and none had been allocated (oops). This happens for libav which has no concept of filter metadata. --- video/filter/vf_lavfi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'video') diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c index f2de4fe9a4..2002c97d16 100644 --- a/video/filter/vf_lavfi.c +++ b/video/filter/vf_lavfi.c @@ -334,10 +334,13 @@ static int control(vf_instance_t *vf, int request, void *data) case VFCTRL_SEEK_RESET: reset(vf); return CONTROL_OK; - case VFCTRL_GET_METADATA:{ - *(struct mp_tags*) data = *vf->priv->metadata; - return CONTROL_OK; - } + case VFCTRL_GET_METADATA: + if (vf->priv && vf->priv->metadata) { + *(struct mp_tags*) data = *vf->priv->metadata; + return CONTROL_OK; + } else { + return CONTROL_NA; + } } return CONTROL_UNKNOWN; } -- cgit v1.2.3