From 77113a9f2ccdb9c84b8a93e59bed984f6700735e Mon Sep 17 00:00:00 2001 From: paul-szczepanek-arm <33840200+paul-szczepanek-arm@users.noreply.github.com> Date: Wed, 30 Jan 2019 11:45:26 +0000 Subject: [PATCH] check scanning status first --- features/FEATURE_BLE/source/generic/GenericGap.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 819857c684..fa9954c191 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -1480,16 +1480,16 @@ BLE_DEPRECATED_API_USE_END() void GenericGap::on_scan_timeout() { + if (!_scan_enabled) { + return; + } + /* if timeout happened on a 4.2 chip we need to stop the scan manually */ if (is_extended_advertising_available()) { _pal_gap.scan_enable(false, false); set_random_address_rotation(false); } - if (!_scan_enabled) { - return; - } - _scan_enabled = false; if (!_eventHandler) {