Commit cc6cc08d authored by Maksim Ivanov's avatar Maksim Ivanov Committed by Commit Bot

Fix use-after-move in //device/bluetooth/

Fix use-after-move (potential) bugs found by the
"bugprone-use-after-move" clang-tidy check.

Bug: 1122844
Change-Id: I75c8e24cb8620f6c5a1650578e12ff1d97330ab0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2560260
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Auto-Submit: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#831191}
parent b535d682
......@@ -1315,14 +1315,14 @@ void BluetoothAdapterWinrt::OnAdvertisementReceived(
return;
}
std::string bluetooth_address =
const std::string bluetooth_address =
BluetoothDeviceWinrt::CanonicalizeAddress(raw_bluetooth_address);
auto it = devices_.find(bluetooth_address);
const bool is_new_device = (it == devices_.end());
if (is_new_device) {
bool was_inserted = false;
std::tie(it, was_inserted) = devices_.emplace(
std::move(bluetooth_address), CreateDevice(raw_bluetooth_address));
bluetooth_address, CreateDevice(raw_bluetooth_address));
DCHECK(was_inserted);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment