From 5469bd318963de20c84fe35f21fe1f1d824e8cb9 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Wed, 19 Dec 2018 23:12:19 -0800 Subject: binding: mediaplayer: fix segfault without playlist and A2DP connected A2DP connection and events with no local media playlist will result in segfaults. Change-Id: I8034d5ae88d2f81ffd74263800c32ded0645d4d8 Signed-off-by: Matt Ranostay --- binding/afm-mediaplayer-binding.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c index 960749c..98887c1 100644 --- a/binding/afm-mediaplayer-binding.c +++ b/binding/afm-mediaplayer-binding.c @@ -967,6 +967,10 @@ static void onevent(afb_api_t api, const char *event, struct json_object *object mediaplayer_set_role_state(api, GST_STATE_PAUSED); } else { json_object *jresp = populate_json_metadata(); + + if (!jresp) + jresp = json_object_new_object(); + json_object_object_add(jresp, "status", json_object_new_string("stopped")); afb_event_push(metadata_event, jresp); -- cgit 1.2.3-korg