Fix use-after-move in SimpleLinkedHashMap
Fix use-after-move (potential) bugs found by the
"bugprone-use-after-move" clang-tidy check (see
https://crbug.com/1122844).
PiperOrigin-RevId: 330937081
Change-Id: I4a9e742d128c444b3c3fec63a35c86bbf2772c7d
diff --git a/common/simple_linked_hash_map.h b/common/simple_linked_hash_map.h
index 6eb6ed9..36933bc 100644
--- a/common/simple_linked_hash_map.h
+++ b/common/simple_linked_hash_map.h
@@ -212,7 +212,7 @@
typename ListType::iterator last = list_.end();
--last;
- CHECK(map_.insert(std::make_pair(pair.first, last)).second)
+ CHECK(map_.insert(std::make_pair(last->first, last)).second)
<< "Map and list are inconsistent";
return std::make_pair(last, true);
}