From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 8/8] AVRCP: Fix not checking for media_player_controller_create Date: Sun, 23 Dec 2012 22:15:18 +0200 Message-Id: <1356293718-9348-8-git-send-email-luiz.dentz@gmail.com> In-Reply-To: <1356293718-9348-1-git-send-email-luiz.dentz@gmail.com> References: <1356293718-9348-1-git-send-email-luiz.dentz@gmail.com> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: From: Luiz Augusto von Dentz Now that the MediaPlayer1 interface is experimental the interface registration may fail which return NULL, in that case there is no point on register to any notifications. --- profiles/audio/avrcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index 4e3d31d..ce070cd 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -1987,6 +1987,11 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn, count = pdu->params[1]; + path = device_get_path(session->dev->btd_dev); + mp = media_player_controller_create(path); + if (mp == NULL) + return FALSE; + for (; count > 0; count--) { uint8_t event = pdu->params[1 + count]; @@ -2001,8 +2006,6 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn, } } - path = device_get_path(session->dev->btd_dev); - mp = media_player_controller_create(path); media_player_set_callbacks(mp, &ct_cbs, player); player->user_data = mp; player->destroy = (GDestroyNotify) media_player_destroy; -- 1.7.11.7