summaryrefslogtreecommitdiffstats
path: root/binding/afm-mediaplayer-binding.c
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-12-19 23:12:19 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-12-19 23:51:56 -0800
commit5469bd318963de20c84fe35f21fe1f1d824e8cb9 (patch)
tree80150b97fc643a1311f5a93e0a9bb002384e754a /binding/afm-mediaplayer-binding.c
parent83c16f45d11aa226cdd5479e25f012a589523ce9 (diff)
binding: mediaplayer: fix segfault without playlist and A2DP connectedhalibut_7.90.0halibut/7.90.0guppy_6.99.4guppy_6.99.3guppy/6.99.4guppy/6.99.37.90.06.99.46.99.3
A2DP connection and events with no local media playlist will result in segfaults. Change-Id: I8034d5ae88d2f81ffd74263800c32ded0645d4d8 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/afm-mediaplayer-binding.c')
-rw-r--r--binding/afm-mediaplayer-binding.c4
1 files changed, 4 insertions, 0 deletions
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);