Remove address from whitelist if the procedure fails.

This prevents a situation where the whitelist contains the address but the procedure errors and the address cannot be added again.
This commit is contained in:
h2zero 2024-06-12 09:28:43 -06:00 committed by h2zero
parent aeb4334e98
commit ef90a8aa95

View file

@ -691,6 +691,7 @@ bool NimBLEDevice::whiteListAdd(const NimBLEAddress & address) {
int rc = ble_gap_wl_set(&wlVec[0], wlVec.size()); int rc = ble_gap_wl_set(&wlVec[0], wlVec.size());
if (rc != 0) { if (rc != 0) {
NIMBLE_LOGE(LOG_TAG, "Failed adding to whitelist rc=%d", rc); NIMBLE_LOGE(LOG_TAG, "Failed adding to whitelist rc=%d", rc);
m_whiteList.pop_back();
return false; return false;
} }