All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] handsfree-audio: Fix replying to an empty D-Bus message
@ 2013-05-03  0:47 Vinicius Costa Gomes
  2013-05-03 16:32 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Vinicius Costa Gomes @ 2013-05-03  0:47 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]

In the case that ofono_handsfree_card_connect_sco() is called outside the
context of a .Connect() call, there's no message we need to reply.  This
happens, for example, when the HFP AG plugin initiates a SCO connection when
it receives an AT+BCC command from the HF.
---
 src/handsfree-audio.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index d78498a..5179ddd 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -248,7 +248,8 @@ static gboolean sco_connect_cb(GIOChannel *io, GIOCondition cond,
 	}
 
 	if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
-		reply = __ofono_error_failed(card->msg);
+		if (card->msg)
+			reply = __ofono_error_failed(card->msg);
 		goto done;
 	}
 
@@ -258,9 +259,13 @@ static gboolean sco_connect_cb(GIOChannel *io, GIOCondition cond,
 
 	close(sk);
 
-	reply = dbus_message_new_method_return(card->msg);
+	if (card->msg)
+		reply = dbus_message_new_method_return(card->msg);
 
 done:
+	if (card->msg == NULL)
+		return FALSE;
+
 	if (reply)
 		g_dbus_send_message(ofono_dbus_get_connection(), reply);
 
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-03 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-03  0:47 [PATCH] handsfree-audio: Fix replying to an empty D-Bus message Vinicius Costa Gomes
2013-05-03 16:32 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.