diff --git a/routing/osrm_router.cpp b/routing/osrm_router.cpp index 982516672f..fcc9f07ea0 100644 --- a/routing/osrm_router.cpp +++ b/routing/osrm_router.cpp @@ -316,7 +316,11 @@ OsrmRouter::ResultCode OsrmRouter::CalculateRoute(m2::PointD const & startPoint, Route::TTimes times; vector points; - MakeTurnAnnotation(routingResult, startMapping, delegate, points, turnsDir, times); + if (MakeTurnAnnotation(routingResult, startMapping, delegate, points, turnsDir, times) != NoError) + { + LOG(LWARNING, ("Can't load road path data from disk!")); + return RouteNotFound; + } route.SetGeometry(points.begin(), points.end()); route.SetTurnInstructions(turnsDir); @@ -468,6 +472,10 @@ OsrmRouter::ResultCode OsrmRouter::MakeTurnAnnotation( } } + // Path found. Points will be replaced by start and end edges points. + if (points.size() == 1) + points.push_back(points.front()); + if (points.size() < 2) return RouteNotFound; diff --git a/routing/routing_integration_tests/osrm_route_test.cpp b/routing/routing_integration_tests/osrm_route_test.cpp index 4058ae9dd5..7e5cda6f90 100644 --- a/routing/routing_integration_tests/osrm_route_test.cpp +++ b/routing/routing_integration_tests/osrm_route_test.cpp @@ -15,6 +15,14 @@ namespace MercatorBounds::FromLatLon(19.172889999999998878, 30.473150000000000404), 7250.); } + UNIT_TEST(MoscowShortRoadUnpacking) + { + integration::CalculateRouteAndTestRouteLength( + integration::GetOsrmComponents(), + MercatorBounds::FromLatLon(55.66218, 37.63253), {0., 0.}, + MercatorBounds::FromLatLon(55.66237, 37.63560), 101.); + } + // Node filtering test. SVO has many restricted service roads that absent in a OSRM index. UNIT_TEST(MoscowToSVOAirport) {