From 4cde67e0ea56219ad717f5e5f35e1c7618c87bfe Mon Sep 17 00:00:00 2001 From: Lev Dragunov Date: Thu, 7 Jan 2016 15:44:35 +0300 Subject: [PATCH] Short single feature routing crash fix. --- routing/osrm2feature_map.cpp | 3 +-- routing/osrm2feature_map.hpp | 4 ++-- routing/osrm_helpers.cpp | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/routing/osrm2feature_map.cpp b/routing/osrm2feature_map.cpp index 661b64a2de..3437e8ce73 100644 --- a/routing/osrm2feature_map.cpp +++ b/routing/osrm2feature_map.cpp @@ -118,8 +118,7 @@ bool IsInside(FtSeg const & bigSeg, FtSeg const & smallSeg) auto segmentLeft = min(bigSeg.m_pointStart, bigSeg.m_pointEnd); auto segmentRight = max(bigSeg.m_pointStart, bigSeg.m_pointEnd); - return (smallSeg.m_pointStart != segmentLeft || smallSeg.m_pointEnd != segmentRight) && - (segmentLeft <= smallSeg.m_pointStart && segmentRight >= smallSeg.m_pointEnd); + return (segmentLeft <= smallSeg.m_pointStart && segmentRight >= smallSeg.m_pointEnd); } FtSeg SplitSegment(FtSeg const & segment, FtSeg const & splitter) diff --git a/routing/osrm2feature_map.hpp b/routing/osrm2feature_map.hpp index 5144ce3dbb..c487a0c6df 100644 --- a/routing/osrm2feature_map.hpp +++ b/routing/osrm2feature_map.hpp @@ -88,8 +88,8 @@ namespace OsrmMappingTypes }; #pragma pack (pop) -/// Checks if a smallSeg is inside a bigSeg and at least one point of a smallSeg differs from -/// point of a bigSeg. Note that the smallSeg must be an ordered segment with 1 point length. +/// Checks if a smallSeg is inside a bigSeg. Note that the smallSeg must be an ordered segment +/// with 1 point length. bool IsInside(FtSeg const & bigSeg, FtSeg const & smallSeg); /// Splits segment by splitter segment and takes part of it. diff --git a/routing/osrm_helpers.cpp b/routing/osrm_helpers.cpp index 9ee1dc7793..f63c50a107 100644 --- a/routing/osrm_helpers.cpp +++ b/routing/osrm_helpers.cpp @@ -128,6 +128,7 @@ void Point2PhantomNode::CalculateWeight(OsrmMappingTypes::FtSeg const & seg, } } + ASSERT(foundSeg, ("Intersection not found!")); ASSERT_GREATER(fullDistanceM, 0, ("No valid segments on the edge.")); double const ratio = (fullDistanceM == 0) ? 0 : distanceM / fullDistanceM; ASSERT_LESS_OR_EQUAL(ratio, 1., ());