This patch avoids sending the SCO fd when the connection is established
and the agent left the bus. This check covers the scenario when the
agent leaves the bus between "Connect" method call until the callback
get called.
---
 src/handsfree-audio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index 8950347..49cdb4c 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -251,7 +251,8 @@ static gboolean sco_connect_cb(GIOChannel *io, GIOCondition 
cond,
 
        sk = g_io_channel_unix_get_fd(io);
 
-       send_new_connection(card->path, sk);
+       if (agent)
+               send_new_connection(card->path, sk);
 
        close(sk);
 
-- 
1.7.11.7

_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to