diff --git a/parse/arrival-or-departure.js b/parse/arrival-or-departure.js index 10b192a1..a59ec6db 100644 --- a/parse/arrival-or-departure.js +++ b/parse/arrival-or-departure.js @@ -21,7 +21,7 @@ const createParseArrOrDep = (profile, opt, data, prefix) => { stop: locations[parseInt(d.stbStop.locX)] || null, when: profile.parseDateTime(profile, d.date, t, tz), // todo: for arrivals, this is the *origin*, not the *direction* - direction: prefix === DEPARTURE && profile.parseStationName(d.dirTxt) || null, + direction: prefix === DEPARTURE && d.dirTxt && profile.parseStationName(d.dirTxt) || null, line: lines[parseInt(d.prodX)] || null, remarks: [] } diff --git a/parse/journey-leg.js b/parse/journey-leg.js index dc46c44f..28320eeb 100644 --- a/parse/journey-leg.js +++ b/parse/journey-leg.js @@ -92,7 +92,7 @@ const createParseJourneyLeg = (profile, opt, data) => { // todo: pull `public` value from `profile.products` res.tripId = pt.jny.jid res.line = lines[parseInt(pt.jny.prodX)] || null - res.direction = profile.parseStationName(pt.jny.dirTxt) || null + res.direction = pt.jny.dirTxt && profile.parseStationName(pt.jny.dirTxt) || null if (pt.dep.dPlatfS) res.departurePlatform = pt.dep.dPlatfS if (pt.arr.aPlatfS) res.arrivalPlatform = pt.arr.aPlatfS diff --git a/parse/movement.js b/parse/movement.js index e797872b..e24b01e5 100644 --- a/parse/movement.js +++ b/parse/movement.js @@ -13,7 +13,7 @@ const createParseMovement = (profile, opt, data) => { const pStopover = profile.parseStopover(profile, opt, data, m.date) const res = { - direction: profile.parseStationName(m.dirTxt), + direction: m.dirTxt ? profile.parseStationName(m.dirTxt) : null, tripId: m.jid || null, line: lines[m.prodX] || null, location: m.pos ? {