From 868e42f5f22df971f818e95f4c49ec98cfa66a54 Mon Sep 17 00:00:00 2001 From: hai007 Date: Fri, 13 Jan 2023 13:38:13 -0800 Subject: [PATCH] Fix a bug in which an iterator is compared to an end iterator from a different hashtable. PiperOrigin-RevId: 501928248 --- internal/platform/implementation/g3/ble_v2.cc | 2 +- internal/platform/implementation/g3/wifi_hotspot.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/platform/implementation/g3/ble_v2.cc b/internal/platform/implementation/g3/ble_v2.cc index 4213e3b3..2b9b5e71 100644 --- a/internal/platform/implementation/g3/ble_v2.cc +++ b/internal/platform/implementation/g3/ble_v2.cc @@ -501,7 +501,7 @@ std::unique_ptr 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=" diff --git a/internal/platform/implementation/g3/wifi_hotspot.cc b/internal/platform/implementation/g3/wifi_hotspot.cc index a772ea74..6d39add7 100644 --- a/internal/platform/implementation/g3/wifi_hotspot.cc +++ b/internal/platform/implementation/g3/wifi_hotspot.cc @@ -273,7 +273,8 @@ std::unique_ptr 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="