summaryrefslogtreecommitdiffstats
path: root/plugins/hfp_ag_bluez5.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2013-03-21 10:19:00 -0500
committerDenis Kenzior <denkenz@gmail.com>2013-03-21 10:19:00 -0500
commit2864624c56dd79eaf8a7122a3dbde1b4c85d8657 (patch)
tree7ee0fb95ecc69cb6c3e4b26b436ca7e652cbae66 /plugins/hfp_ag_bluez5.c
parent823215ff669a78d8c031f631c8ab3134e35d62f3 (diff)
downloadofono-2864624c56dd79eaf8a7122a3dbde1b4c85d8657.tar.bz2
hfp_ag_bluez5: Fix sanity check
We should be checking that modems != NULL, not modems->data. This is because the list can be empty and we would crash.
Diffstat (limited to 'plugins/hfp_ag_bluez5.c')
-rw-r--r--plugins/hfp_ag_bluez5.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/hfp_ag_bluez5.c b/plugins/hfp_ag_bluez5.c
index a81adfd7..64ea8ca1 100644
--- a/plugins/hfp_ag_bluez5.c
+++ b/plugins/hfp_ag_bluez5.c
@@ -84,14 +84,14 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
DBG("%s", device);
/* Pick the first voicecall capable modem */
- modem = modems->data;
- if (modem == NULL) {
+ if (modems == NULL) {
close(fd);
return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
".Rejected",
"No voice call capable modem");
}
+ modem = modems->data;
DBG("Picked modem %p for emulator", modem);
em = ofono_emulator_create(modem, OFONO_EMULATOR_TYPE_HFP);