diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF51/source/nRF5xPalSecurityManager.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF51/source/nRF5xPalSecurityManager.cpp index 9a4a15fac8..e797b85223 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF51/source/nRF5xPalSecurityManager.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF51/source/nRF5xPalSecurityManager.cpp @@ -354,7 +354,7 @@ ble_error_t nRF5xSecurityManager::cancel_pairing( // a pairing feature exchange from a central. if (!pairing_cb) { ::Gap::Role_t current_role; - if (!nRF5xn::Instance().getGap().get_role(connection, current_role)) { + if (nRF5xn::Instance().getGap().get_role(connection, current_role) != BLE_ERROR_NONE) { return BLE_ERROR_INVALID_PARAM; } diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xPalSecurityManager.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xPalSecurityManager.cpp index 7894b367c7..49ea2de83d 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xPalSecurityManager.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xPalSecurityManager.cpp @@ -331,7 +331,7 @@ ble_error_t nRF5xSecurityManager::cancel_pairing( // a pairing feature exchange from a central. if (!pairing_cb) { ::Gap::Role_t current_role; - if (!nRF5xn::Instance().getGap().get_role(connection, current_role)) { + if (nRF5xn::Instance().getGap().get_role(connection, current_role) != BLE_ERROR_NONE) { return BLE_ERROR_INVALID_PARAM; }