From cd24931b171f73d6ba71450493e9d5a8142a67a5 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Tue, 21 Nov 2017 13:30:47 +0100 Subject: Enforce numberAlternativeRoutes where possible when doing route requests Change-Id: I321e802d795df36d8cdd1b8578e77094c500cc2e Reviewed-by: Alex Blasche --- src/plugins/geoservices/mapbox/qgeoroutereplymapbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/geoservices/mapbox/qgeoroutereplymapbox.cpp') diff --git a/src/plugins/geoservices/mapbox/qgeoroutereplymapbox.cpp b/src/plugins/geoservices/mapbox/qgeoroutereplymapbox.cpp index 8fc3386a..3099657b 100644 --- a/src/plugins/geoservices/mapbox/qgeoroutereplymapbox.cpp +++ b/src/plugins/geoservices/mapbox/qgeoroutereplymapbox.cpp @@ -188,7 +188,7 @@ void QGeoRouteReplyMapbox::networkReplyFinished() QList list; QJsonArray routes = object.value(QStringLiteral("routes")).toArray(); - for (int i = 0; i < routes.count(); i++) { + for (int i = 0; i < qMin(routes.count(), request().numberAlternativeRoutes() + 1); i++) { QGeoRoute route = constructRoute(routes.at(i).toObject()); list.append(route); } -- cgit v1.2.1