diff options
author | Добрый Ээх <bukharaev@gmail.com> | 2017-03-06 17:51:45 +0300 |
---|---|---|
committer | Sergey Yershov <syershov@maps.me> | 2017-03-06 18:18:06 +0300 |
commit | c4059caf3a58c7ee72415d3cdd64bd4887902071 (patch) | |
tree | 654a65ee4d0f157802dc767a6613bdf283ea4c67 /routing | |
parent | 460a725b22a4d9c9ccae8fd7d769448b9d393de3 (diff) |
[tracking] Pull request #5526 review fixesbeta-663
Diffstat (limited to 'routing')
-rw-r--r-- | routing/routing_session.cpp | 5 | ||||
-rw-r--r-- | routing/routing_session.hpp | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/routing/routing_session.cpp b/routing/routing_session.cpp index 2e6f65c812..7a613102d9 100644 --- a/routing/routing_session.cpp +++ b/routing/routing_session.cpp @@ -447,10 +447,13 @@ traffic::SpeedGroup RoutingSession::MatchTraffic( if (!routeMatchingInfo.IsMatched()) return SpeedGroup::Unknown; - threads::MutexGuard guard(m_routingSessionMutex); size_t const index = routeMatchingInfo.GetIndexInRoute(); + threads::MutexGuard guard(m_routingSessionMutex); vector<traffic::SpeedGroup> const & traffic = m_route->GetTraffic(); + if (traffic.empty()) + return SpeedGroup::Unknown; + if (index >= traffic.size()) { LOG(LERROR, ("Invalid index", index, "in RouteMatchingInfo, traffic.size():", traffic.size())); diff --git a/routing/routing_session.hpp b/routing/routing_session.hpp index 63e8c05af5..a94a102dc3 100644 --- a/routing/routing_session.hpp +++ b/routing/routing_session.hpp @@ -126,6 +126,8 @@ public: void MatchLocationToRoute(location::GpsInfo & location, location::RouteMatchingInfo & routeMatchingInfo) const; + // Get traffic speed for the current route position. + // Returns SpeedGroup::Unknown if any trouble happens: position doesn't match with route or something else. traffic::SpeedGroup MatchTraffic(location::RouteMatchingInfo const & routeMatchingInfo) const; void SetUserCurrentPosition(m2::PointD const & position); |