From bd5f437896cac29ca69e0021bdbcd5954fbf0a08 Mon Sep 17 00:00:00 2001 From: Paul Szczepanek Date: Wed, 27 Jan 2021 16:32:57 +0000 Subject: [PATCH] return OK when stopping advertising that is not active --- connectivity/FEATURE_BLE/source/generic/GapImpl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp b/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp index 27227689e4..12b97cf902 100644 --- a/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp +++ b/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp @@ -2120,10 +2120,14 @@ ble_error_t Gap::stopAdvertising(advertising_handle_t handle) } #endif // BLE_FEATURE_EXTENDED_ADVERTISING - if (!_active_sets.get(handle) || _pending_sets.get(handle)) { + if (_pending_sets.get(handle)) { return BLE_STACK_BUSY; } + if (!_active_sets.get(handle)) { + return BLE_ERROR_NONE; + } + #if BLE_FEATURE_EXTENDED_ADVERTISING if (is_extended_advertising_available()) { status = _pal_gap.extended_advertising_enable(