From 0d90671842521fd8749724b05fe58f69cad7cc3a Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Sat, 10 Nov 2018 17:24:14 +0000 Subject: [PATCH] BLE: Fix release of advertising sets. --- features/FEATURE_BLE/source/generic/GenericGap.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 8f45403def..9b5921ff8f 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -1617,11 +1617,15 @@ ble_error_t GenericGap::createAdvertisingSet( } ble_error_t GenericGap::destroyAdvertisingSet(AdvHandle_t handle) { + if (is_extended_advertising_available()) { + return BLE_ERROR_OPERATION_NOT_PERMITTED; + } + if (handle >= getMaxAdvertisingSetNumber()) { return BLE_ERROR_INVALID_PARAM; } - if (_existing_sets.get(handle)) { + if (_existing_sets.get(handle) == false) { return BLE_ERROR_INVALID_PARAM; }