[gnome-maps/wip/mlundblad/transit-plugin-gometro: 1/2] transitLegRow: Handle legs with no intermediate stops
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/transit-plugin-gometro: 1/2] transitLegRow: Handle legs with no intermediate stops
- Date: Tue, 17 Mar 2020 19:38:50 +0000 (UTC)
commit f6d247622e4c9af172642936626928fd42365642
Author: Marcus Lundblad <ml update uu se>
Date: Wed Feb 5 22:59:18 2020 +0100
transitLegRow: Handle legs with no intermediate stops
Handle the case where the list of intermediate stops
for a leg is not set, for plugins that do not support
showing them.
src/transitLegRow.js | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/transitLegRow.js b/src/transitLegRow.js
index 1d7444e3..142cf7c9 100644
--- a/src/transitLegRow.js
+++ b/src/transitLegRow.js
@@ -178,14 +178,16 @@ var TransitLegRow = GObject.registerClass({
_populateInstructions() {
if (this._leg.transit) {
- let stops = this._leg.intermediateStops;
- for (let index = 0; index < stops.length; index++) {
- let stop = stops[index];
- let row =
- new TransitStopRow.TransitStopRow({ visible: true,
- stop: stop,
- final: index === stops.length - 1 });
- this._instructionList.add(row);
+ if (this._leg.intermediateStops) {
+ let stops = this._leg.intermediateStops;
+ for (let index = 0; index < stops.length; index++) {
+ let stop = stops[index];
+ let row =
+ new TransitStopRow.TransitStopRow({ visible: true,
+ stop: stop,
+ final: index === stops.length - 1 });
+ this._instructionList.add(row);
+ }
}
} else {
/* don't output the starting and ending instructions from the walk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]