From fa8ed8c9ac177654244b1af241d61747df547a9b Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Tue, 20 Dec 2016 15:58:25 +0300 Subject: [PATCH] [routing] Crashfix. Processing errors while turn generation. --- routing/routing_helpers.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/routing/routing_helpers.cpp b/routing/routing_helpers.cpp index 4ab83be9f2..11558c3a73 100644 --- a/routing/routing_helpers.cpp +++ b/routing/routing_helpers.cpp @@ -32,6 +32,16 @@ void ReconstructRoute(IDirectionsEngine * engine, IRoadGraph const & graph, if (engine) engine->Generate(graph, path, times, turnsDir, junctions, trafficSegs, cancellable); + if (cancellable.IsCancelled()) + return; + + // In case of any errors in IDirectionsEngine::Generate() |junctions| is empty. + if (junctions.empty()) + { + LOG(LERROR, ("Internal error happened while turn generation.")); + return; + } + // @TODO(bykoianko) If the start and the finish of a route lies on the same road segment // engine->Generate() fills with empty vectors |times|, |turnsDir|, |junctions| and |trafficSegs|. // It's not correct and should be fixed. It's necessary to work corrrectly with such routes.