diff options
author | Mikhail Gorbushin <m.gorbushin@corp.mail.ru> | 2019-05-07 15:54:19 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <bykoianko@gmail.com> | 2019-05-14 17:55:41 +0300 |
commit | 243151201f4bd40fee1d11fe18804afc35892e51 (patch) | |
tree | 0d7e632405861b63b4095867787e576c67ecc391 /routing | |
parent | 8acd30e4efe85a3e06d9e439a7534370b84bca88 (diff) |
[routing] fix assert crash for zero route length
Diffstat (limited to 'routing')
-rw-r--r-- | routing/index_router.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/routing/index_router.cpp b/routing/index_router.cpp index 8f9cde0710..e9130049f2 100644 --- a/routing/index_router.cpp +++ b/routing/index_router.cpp @@ -423,8 +423,11 @@ RouterResultCode IndexRouter::DoCalculateRoute(Checkpoints const & checkpoints, isStartSegmentStrictForward, *graph); vector<Segment> subroute; + static double constexpr kEpsAlmostZero = 1e-7; double const contributionCoef = - MercatorBounds::DistanceOnEarth(startCheckpoint, finishCheckpoint) / checkpointsLength; + !base::AlmostEqualAbs(checkpointsLength, 0.0, kEpsAlmostZero) ? + MercatorBounds::DistanceOnEarth(startCheckpoint, finishCheckpoint) / checkpointsLength : + kEpsAlmostZero; AStarSubProgress subProgress(startCheckpoint, finishCheckpoint, contributionCoef); progress.AppendSubProgress(subProgress); |