summaryrefslogtreecommitdiffstats
path: root/src/dbus-hci.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-10-07 10:52:25 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2008-10-07 10:52:25 +0200
commitacd17f476e4aba09becc325d1562f6c8db5e24ec (patch)
tree74b3dfa3903b918351a685f8fa3ffb2e77776dac /src/dbus-hci.c
parentb944b75c85b5639fef6376c873c672ee033f18ea (diff)
Check for NULL return of adapter_find_device
In theory the device might have been removed if the D-Bus client exited before the remote side accepted the pairing. This is just a short term fix since security.c is still storing the link key. In the long run we should move the link key storing to dbus-hci.c and only do it when we get auth complete or connect complete.
Diffstat (limited to 'src/dbus-hci.c')
-rw-r--r--src/dbus-hci.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index 4ba5e129..2ae307e8 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -1101,6 +1101,10 @@ void hcid_dbus_link_key_notify(bdaddr_t *local, bdaddr_t *peer)
ba2str(peer, peer_addr);
device = adapter_find_device(adapter, peer_addr);
+ if (!device) {
+ error("link_key_notify: device %s was removed!", peer_addr);
+ return;
+ }
bonding = adapter_get_bonding_info(adapter);