summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2013-05-02 21:47:16 -0300
committerDenis Kenzior <denkenz@gmail.com>2013-05-03 11:31:44 -0500
commit8caf91bf0f6d81e90c12b2ea2f2bcd726e3f2d4a (patch)
tree6329287d9d2a68a18de300560b7e2e86465d556c /src
parent856a8840520b24187b3195979803328ad20cfbd4 (diff)
downloadofono-8caf91bf0f6d81e90c12b2ea2f2bcd726e3f2d4a.tar.bz2
handsfree-audio: Fix replying to an empty D-Bus message
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.
Diffstat (limited to 'src')
-rw-r--r--src/handsfree-audio.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index d78498a0..5179dddd 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);