mirror of
https://github.com/Evolution-X-Devices/device_xiaomi_sm6150-common
synced 2026-01-27 07:38:17 +00:00
sm6150-common: gps: Avoid access of deprecated LocUnorderedSetMap entry
When there is no client listens to some DataItemId, we will remove the map entry. Can't access the deleted entry's iterator anymore. Change-Id: Id64aadebf7362667fbcf0fd5191f888ed9241727 CRs-Fixed: 3886536 (cherry picked from commit 0049d459cc1772f328e29a4c6b6d129af132e7b8) Signed-off-by: therealmharc <therealmharc@gmail.com>
This commit is contained in:
@@ -141,8 +141,11 @@ public:
|
|||||||
unordered_set<KEY>* goneKeys, unordered_set<VAL>* goneVals) {
|
unordered_set<KEY>* goneKeys, unordered_set<VAL>* goneVals) {
|
||||||
for (auto key : keys) {
|
for (auto key : keys) {
|
||||||
auto iter = mMap.find(key);
|
auto iter = mMap.find(key);
|
||||||
if (iter != mMap.end() && trimOrRemove(iter, rVals, goneVals) && nullptr != goneKeys) {
|
if (iter != mMap.end()) {
|
||||||
goneKeys->insert(iter->first);
|
KEY goneKey = iter->first;
|
||||||
|
if (trimOrRemove(iter, rVals, goneVals) && nullptr != goneKeys) {
|
||||||
|
goneKeys->insert(goneKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user