summaryrefslogtreecommitdiffstats
path: root/plugins/dun_gw_bluez5.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2013-03-21 10:18:11 -0500
committerDenis Kenzior <denkenz@gmail.com>2013-03-21 10:18:11 -0500
commit823215ff669a78d8c031f631c8ab3134e35d62f3 (patch)
treefd05f88dd2243c4b742f8da8a01389a6aef8c06d /plugins/dun_gw_bluez5.c
parent439712a937c25e5a9b6ec195646fe9f9bd965864 (diff)
downloadofono-823215ff669a78d8c031f631c8ab3134e35d62f3.tar.bz2
dun_gw_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/dun_gw_bluez5.c')
-rw-r--r--plugins/dun_gw_bluez5.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/dun_gw_bluez5.c b/plugins/dun_gw_bluez5.c
index bd0d5530..9844092f 100644
--- a/plugins/dun_gw_bluez5.c
+++ b/plugins/dun_gw_bluez5.c
@@ -81,14 +81,14 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
DBG("%s", device);
/* Pick the first powered modem */
- modem = modems->data;
- if (modem == NULL) {
+ if (modems == NULL) {
close(fd);
return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
".Rejected",
"No GPRS capable modem");
}
+ modem = modems->data;
DBG("Picked modem %p for emulator", modem);
em = ofono_emulator_create(modem, OFONO_EMULATOR_TYPE_DUN);