diff options
Diffstat (limited to 'hcid/adapter.c')
-rw-r--r-- | hcid/adapter.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c index e70f31c2..753a1c47 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -746,6 +746,7 @@ void adapter_remove_device(DBusConnection *conn, struct adapter *adapter, bdaddr_t src; const gchar *destination = device_get_address(device); const gchar *dev_path = device_get_path(device); + struct agent *agent; str2ba(adapter->address, &src); delete_entry(&src, "profiles", destination); @@ -760,8 +761,10 @@ void adapter_remove_device(DBusConnection *conn, struct adapter *adapter, DBUS_TYPE_INVALID); } - if (device->agent) { - agent_destroy(device->agent, FALSE); + agent = device_get_agent(device); + + if (agent) { + agent_destroy(agent, FALSE); device->agent = NULL; } |