From 0a3cd69fc66c8ca5389cfb3d699371f0e2ebc78e Mon Sep 17 00:00:00 2001 From: Paul Szczeanek Date: Thu, 17 Sep 2020 12:26:34 +0100 Subject: [PATCH] event handler should not affect internal state --- connectivity/FEATURE_BLE/source/generic/GapImpl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp b/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp index b194ba6cf9..f28e4da1e1 100644 --- a/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp +++ b/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp @@ -2333,13 +2333,14 @@ void Gap::on_enhanced_connection_complete( clock_accuracy_t master_clock_accuracy ) { + if (own_role == connection_role_t::CENTRAL) { + _initiating = false; + } + if (!_event_handler) { return; } - if (own_role == connection_role_t::CENTRAL) { - _initiating = false; - } _event_handler->onConnectionComplete( ConnectionCompleteEvent(