Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortatiana-yan <tatiana.kondakova@gmail.com>2021-03-24 13:40:46 +0300
committerOlga Khlopkova <mesozoic.drones@gmail.com>2021-03-24 13:45:36 +0300
commit962496b4aeab02153ea1f390ac06447d977dd6ab (patch)
treeae32d919663afd2a0e29185ae67f9617c18746bc
parent5b88872cd1262fa5e2a095959d23bd17fc724342 (diff)
[transit] Fix invalid stops dereference.
-rw-r--r--transit/world_feed/world_feed.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/transit/world_feed/world_feed.cpp b/transit/world_feed/world_feed.cpp
index 529c74149a..a9734d0258 100644
--- a/transit/world_feed/world_feed.cpp
+++ b/transit/world_feed/world_feed.cpp
@@ -1104,32 +1104,39 @@ std::pair<size_t, size_t> WorldFeed::ModifyShapes()
if (invalidStopSequences > kMaxInvalidShapesCount)
return {invalidStopSequences, validStopSequences};
}
- auto const [stop1, stop2] = *stops;
- lastIndex = stop2.m_index;
for (auto const lineId : lineIds)
{
if (!stopsOnLines.m_isValid)
+ {
m_lines.m_data.erase(lineId);
+ // todo: use std::erase_if after c++20
+ for (auto it = m_edges.m_data.begin(); it != m_edges.m_data.end();)
+ {
+ if (it->first.m_lineId == lineId)
+ it = m_edges.m_data.erase(it);
+ else
+ ++it;
+ }
+ }
+ else
+ {
+ CHECK(stops, ());
+ auto const [stop1, stop2] = *stops;
+ lastIndex = stop2.m_index;
- // Update |EdgeShapeLink| with shape segment start and end points.
- auto itEdge = m_edges.m_data.find(EdgeId(stop1.m_id, stop2.m_id, lineId));
- if (itEdge == m_edges.m_data.end())
- continue;
+ // Update |EdgeShapeLink| with shape segment start and end points.
+ auto itEdge = m_edges.m_data.find(EdgeId(stop1.m_id, stop2.m_id, lineId));
+ if (itEdge == m_edges.m_data.end())
+ continue;
- if (stopsOnLines.m_isValid)
- {
itEdge->second.m_shapeLink.m_startIndex = static_cast<uint32_t>(stop1.m_index);
itEdge->second.m_shapeLink.m_endIndex = static_cast<uint32_t>(stop2.m_index);
- }
- else
- {
- m_edges.m_data.erase(itEdge);
+
+ if (indexes[stop1.m_id].size() > 1)
+ indexes[stop1.m_id].erase(indexes[stop1.m_id].begin());
}
}
-
- if (indexes[stop1.m_id].size() > 1)
- indexes[stop1.m_id].erase(indexes[stop1.m_id].begin());
}
}
}