diff options
| author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-02-26 00:03:10 +0200 | 
|---|---|---|
| committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-02-26 00:03:10 +0200 | 
| commit | 5fa1445615ba636b9a1aab409476dd89fb14e9af (patch) | |
| tree | 8ab7c44b1934727427908b9fb1faa6258236ca54 | |
| parent | 118aad507231bfa28b0621e389f7f717b0065671 (diff) | |
Add checks for pending connect to sco_connect_cb
| -rw-r--r-- | audio/headset.c | 18 | 
1 files changed, 11 insertions, 7 deletions
diff --git a/audio/headset.c b/audio/headset.c index 42db576b..3b1b6772 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -523,10 +523,11 @@ static void sco_connect_cb(GIOChannel *chan, GError *err, gpointer user_data)  	if (err) {  		error("%s", err->message); -		if (p->msg) +		if (p && p->msg)  			error_connection_attempt_failed(dev->conn, p->msg, p->err);  		pending_connect_finalize(dev); +  		if (hs->rfcomm)  			headset_set_state(dev, HEADSET_STATE_CONNECTED);  		else @@ -541,14 +542,17 @@ static void sco_connect_cb(GIOChannel *chan, GError *err, gpointer user_data)  	debug("SCO fd=%d", sk);  	hs->sco = g_io_channel_ref(chan); -	p->io = NULL; -	if (p->msg) { -		DBusMessage *reply = dbus_message_new_method_return(p->msg); -		g_dbus_send_message(dev->conn, reply); -	} +	if (p) { +		p->io = NULL; +		if (p->msg) { +			DBusMessage *reply; +			reply = dbus_message_new_method_return(p->msg); +			g_dbus_send_message(dev->conn, reply); +		} -	pending_connect_finalize(dev); +		pending_connect_finalize(dev); +	}  	fcntl(sk, F_SETFL, 0);  | 
