Guard enableNotifications against missing connection entry

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
torlando-techandClaude Opus 4.6 committed 2026-03-05 12:05:50 -05:00
1 parent 8013597a5f
commit 74def922a7
1 file changed
+4 -2
@@ -1906,9 +1906,11 @@ bool NimBLEPlatform::enableNotifications(uint16_t conn_handle, bool enable) {
}
auto conn_it = _connections.find(conn_handle);
if (conn_it != _connections.end()) {
expected_peer = conn_it->second.peer_address;
if (conn_it == _connections.end()) {
xSemaphoreGive(_conn_mutex);
return false;
}
expected_peer = conn_it->second.peer_address;
beginWriteOperation();
xSemaphoreGive(_conn_mutex);