diff --git a/android/bluetooth.c b/android/bluetooth.c
index b105ac8..d74d792 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
const void *param, void *user_data)
{
const struct mgmt_ev_auth_failed *ev = param;
+ struct device *dev;
if (length < sizeof(*ev)) {
error("Too small auth failed mgmt event (%u bytes)", length);
DBG("");
- set_device_bond_state(&ev->addr.bdaddr, status_mgmt2hal(ev->status),
- HAL_BOND_STATE_NONE);
+ dev = find_device(&ev->addr.bdaddr);
+
+ if (dev && dev->bond_state == HAL_BOND_STATE_BONDING)
+ set_device_bond_state(&ev->addr.bdaddr,
+ status_mgmt2hal(ev->status),
+ HAL_BOND_STATE_NONE);
}
static void mgmt_device_unpaired_event(uint16_t index, uint16_t length,