Fix a bug in which an iterator is compared to an end iterator from a different hashtable.

PiperOrigin-RevId: 501928248
This commit is contained in:
hai007
2023-01-13 13:40:47 -08:00
committed by Copybara-Service
parent 0e2111afc2
commit 868e42f5f2
2 changed files with 3 additions and 2 deletions
@@ -501,7 +501,7 @@ std::unique_ptr<api::ble_v2::BleSocket> BleV2Medium::Connect(
absl::MutexLock medium_lock(&remote_medium->mutex_);
auto item = remote_medium->server_sockets_.find(service_id);
remote_server_socket =
item != server_sockets_.end() ? item->second : nullptr;
item != remote_medium->server_sockets_.end() ? item->second : nullptr;
if (remote_server_socket == nullptr) {
NEARBY_LOGS(ERROR)
<< "G3 Ble Failed to find Ble Server socket: service_id="
@@ -273,7 +273,8 @@ std::unique_ptr<api::WifiHotspotSocket> WifiHotspotMedium::ConnectToService(
{
absl::MutexLock medium_lock(&remote_medium->mutex_);
auto item = remote_medium->server_sockets_.find(socket_name);
server_socket = item != server_sockets_.end() ? item->second : nullptr;
server_socket =
item != remote_medium->server_sockets_.end() ? item->second : nullptr;
if (server_socket == nullptr) {
NEARBY_LOGS(ERROR) << "G3 WifiHotspot Failed to find WifiHotspot Server "
"socket: socket_name="