Skip to content

Commit e7d0ad2

Browse files
authored
Update BLEScan.cpp (#5241)
Proposed fix to #4627 as a remediation to PR #3995 #3995 introduced that a device detected on BLE would not be entered in vector if a callback has been defined. By doing so, it was not possible anymore to have a counter in a call back (AND device in vector) to limit the number of detected device in a single scan, which could crash ESP32 as a result.
1 parent 77f5044 commit e7d0ad2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libraries/BLE/src/BLEScan.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ void BLEScan::handleGAPEvent(
126126

127127
if (m_pAdvertisedDeviceCallbacks) { // if has callback, no need to record to vector
128128
m_pAdvertisedDeviceCallbacks->onResult(*advertisedDevice);
129-
} else if (!m_wantDuplicates && !found) { // if no callback and not want duplicate, and not already in vector, record it
129+
}
130+
if (!m_wantDuplicates && !found) { // if no callback and not want duplicate, and not already in vector, record it
130131
m_scanResults.m_vectorAdvertisedDevices.insert(std::pair<std::string, BLEAdvertisedDevice*>(advertisedAddress.toString(), advertisedDevice));
131132
shouldDelete = false;
132133
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy