forked from organicmaps/organicmaps
Routing stats crash fix.
This commit is contained in:
parent
85b9c404c6
commit
55fbfc7d30
2 changed files with 12 additions and 4 deletions
|
@ -2056,7 +2056,7 @@ void Framework::RemoveRoute(bool deactivateFollowing)
|
|||
|
||||
void Framework::CloseRouting()
|
||||
{
|
||||
if (m_routingSession.IsActive())
|
||||
if (m_routingSession.IsBuilt())
|
||||
{
|
||||
auto const lastGoodPoint = MercatorBounds::ToLatLon(
|
||||
m_routingSession.GetRoute().GetFollowedPolyline().GetCurrentIter().m_pt);
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue