mirror of git://git.sysmocom.de/ofono
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.
This commit is contained in:
parent
823215ff66
commit
2864624c56
|
@ -84,14 +84,14 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
|
||||||
DBG("%s", device);
|
DBG("%s", device);
|
||||||
|
|
||||||
/* Pick the first voicecall capable modem */
|
/* Pick the first voicecall capable modem */
|
||||||
modem = modems->data;
|
if (modems == NULL) {
|
||||||
if (modem == NULL) {
|
|
||||||
close(fd);
|
close(fd);
|
||||||
return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
|
return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
|
||||||
".Rejected",
|
".Rejected",
|
||||||
"No voice call capable modem");
|
"No voice call capable modem");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modem = modems->data;
|
||||||
DBG("Picked modem %p for emulator", modem);
|
DBG("Picked modem %p for emulator", modem);
|
||||||
|
|
||||||
em = ofono_emulator_create(modem, OFONO_EMULATOR_TYPE_HFP);
|
em = ofono_emulator_create(modem, OFONO_EMULATOR_TYPE_HFP);
|
||||||
|
|
Loading…
Reference in New Issue