diff options
author | Lev Dragunov <l.dragunov@corp.mail.ru> | 2016-02-08 14:48:36 +0300 |
---|---|---|
committer | Lev Dragunov <l.dragunov@corp.mail.ru> | 2016-02-08 14:48:36 +0300 |
commit | 55fbfc7d306361dd049e744487ece92b8f3b1d11 (patch) | |
tree | 125f4dda8c143b191c3263fdeee0053ec4d6fdf5 /routing | |
parent | 85b9c404c67a6cce801f28df8ff0b125b2ae5a48 (diff) |
Routing stats crash fix.
Diffstat (limited to 'routing')
-rw-r--r-- | routing/base/followed_polyline.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/routing/base/followed_polyline.cpp b/routing/base/followed_polyline.cpp index 05491a038e..92d38dc9d8 100644 --- a/routing/base/followed_polyline.cpp +++ b/routing/base/followed_polyline.cpp @@ -43,14 +43,22 @@ double FollowedPolyline::GetDistanceM(Iter const & it1, Iter const & it2) const double FollowedPolyline::GetTotalDistanceM() const { - ASSERT(IsValid(), ()); + if (!IsValid()) + { + ASSERT(IsValid(), ()); + return 0; + } return m_segDistance.back(); } double FollowedPolyline::GetDistanceFromBeginM() const { - ASSERT(IsValid(), ()); - ASSERT(m_current.IsValid(), ()); + if (!IsValid() || !m_current.IsValid()) + { + ASSERT(IsValid(), ()); + ASSERT(m_current.IsValid(), ()); + return 0; + } return (m_current.m_ind > 0 ? m_segDistance[m_current.m_ind - 1] : 0.0) + MercatorBounds::DistanceOnEarth(m_current.m_pt, m_poly.GetPoint(m_current.m_ind)); |