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-29 15:41:19 +0300
committerOlga Khlopkova <mesozoic.drones@gmail.com>2021-03-30 10:37:00 +0300
commit651aca152f6dda7d3bc1b5f4121ffe85e0a60933 (patch)
tree1fc4fe5f0fd1c2c21e0b020ce7b14fc6f19bdc74 /transit
parent639d866ab783a9e9c2736712fe570c14315e3c12 (diff)
[transit][world_feed] Fix crashes.
Diffstat (limited to 'transit')
-rw-r--r--transit/transit_schedule.cpp6
-rw-r--r--transit/world_feed/world_feed.cpp15
2 files changed, 14 insertions, 7 deletions
diff --git a/transit/transit_schedule.cpp b/transit/transit_schedule.cpp
index 37e581627b..a0c26bc4cf 100644
--- a/transit/transit_schedule.cpp
+++ b/transit/transit_schedule.cpp
@@ -277,8 +277,10 @@ FrequencyIntervals::FrequencyIntervals(gtfs::Frequencies const & frequencies)
{
for (auto const & freq : frequencies)
{
- CHECK_GREATER(freq.headway_secs, 0, ());
- m_intervals.emplace(TimeInterval(freq.start_time, freq.end_time), freq.headway_secs);
+ if (freq.headway_secs > 0)
+ m_intervals.emplace(TimeInterval(freq.start_time, freq.end_time), freq.headway_secs);
+ else
+ LOG(LINFO, ("Bad headway_secs:", freq.headway_secs));
}
}
diff --git a/transit/world_feed/world_feed.cpp b/transit/world_feed/world_feed.cpp
index 9a1b956087..3c655d15a2 100644
--- a/transit/world_feed/world_feed.cpp
+++ b/transit/world_feed/world_feed.cpp
@@ -475,7 +475,11 @@ bool WorldFeed::FillRoutes()
continue;
auto const itAgencyHash = m_gtfsIdToHash[FieldIdx::AgencyIdx].find(route.agency_id);
- CHECK(itAgencyHash != m_gtfsIdToHash[FieldIdx::AgencyIdx].end(), (route.agency_id));
+ if (itAgencyHash == m_gtfsIdToHash[FieldIdx::AgencyIdx].end())
+ {
+ LOG(LINFO, ("Unknown agency", route.agency_id));
+ continue;
+ }
auto const & agencyHash = itAgencyHash->second;
CHECK(!agencyHash.empty(), ("Empty hash for agency id:", route.agency_id));
@@ -927,7 +931,7 @@ std::optional<Direction> WorldFeed::ProjectStopsToShape(
CHECK(itStop != m_stops.m_data.end(), (stopId));
auto const & stop = itStop->second;
- size_t const prevIdx = i == 0 ? (direction == Direction::Forward ? 0 : shape.size())
+ size_t const prevIdx = i == 0 ? (direction == Direction::Forward ? 0 : shape.size() - 1)
: stopsToIndexes[stopIds[i - 1]].back();
auto const [curIdx, pointInserted] =
PrepareNearestPointOnTrack(stop.m_point, prevPoint, prevIdx, direction, shape);
@@ -1932,12 +1936,13 @@ void WorldFeed::SplitLinesBasedData()
auto const edgeFirst = m_edges.m_data.at(
EdgeId(lineData.m_stopIds[firstStopIdx], lineData.m_stopIds[firstStopIdx + 1], lineId));
- CHECK(!(edgeFirst.m_shapeLink.m_startIndex == 0 && edgeFirst.m_shapeLink.m_endIndex == 0),
- ());
+ if (edgeFirst.m_shapeLink.m_startIndex == 0 && edgeFirst.m_shapeLink.m_endIndex == 0)
+ continue;
auto const edgeLast = m_edges.m_data.at(
EdgeId(lineData.m_stopIds[lastStopIdx - 1], lineData.m_stopIds[lastStopIdx], lineId));
- CHECK(!(edgeLast.m_shapeLink.m_startIndex == 0 && edgeLast.m_shapeLink.m_endIndex == 0), ());
+ if (edgeLast.m_shapeLink.m_startIndex == 0 && edgeLast.m_shapeLink.m_endIndex == 0)
+ continue;
lineInRegion.m_shapeLink.m_startIndex =
std::min(edgeFirst.m_shapeLink.m_startIndex, edgeLast.m_shapeLink.m_endIndex);