[gnome-maps] openTripPlanner: Check for found rout in _fetchRoute()
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] openTripPlanner: Check for found rout in _fetchRoute()
- Date: Tue, 24 Sep 2019 20:04:13 +0000 (UTC)
commit f061b4e0d59aa79121a3e727b331fdba38a4582a
Author: Marcus Lundblad <ml update uu se>
Date: Tue Sep 24 22:01:19 2019 +0200
openTripPlanner: Check for found rout in _fetchRoute()
After the change to remove support for
looking up supported routers from the server,
the case where no suitable transit stop was found
was broken. Fix with a check in the callback.
Fixes #211
src/transitplugins/openTripPlanner.js | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/src/transitplugins/openTripPlanner.js b/src/transitplugins/openTripPlanner.js
index 2f6e945..346bb8f 100644
--- a/src/transitplugins/openTripPlanner.js
+++ b/src/transitplugins/openTripPlanner.js
@@ -506,22 +506,26 @@ var OpenTripPlanner = class OpenTripPlanner {
let points = this._query.filledPoints;
this._fetchRoutes((route) => {
- let itineraries = [];
- let plan = route.plan;
-
- if (plan && plan.itineraries) {
- itineraries =
- itineraries.concat(
- this._createItineraries(plan.itineraries));
- }
+ if (route) {
+ let itineraries = [];
+ let plan = route.plan;
+
+ if (plan && plan.itineraries) {
+ itineraries =
+ itineraries.concat(
+ this._createItineraries(plan.itineraries));
+ }
- if (itineraries.length === 0) {
- /* don't reset query points, unlike for turn-based
- * routing, since options and timeing might influence
- * results */
- this._noRouteFound();
+ if (itineraries.length === 0) {
+ /* don't reset query points, unlike for turn-based
+ * routing, since options and timeing might influence
+ * results */
+ this._noRouteFound();
+ } else {
+ this._recalculateItineraries(itineraries);
+ }
} else {
- this._recalculateItineraries(itineraries);
+ this._noRouteFound();
}
});
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]