Skip to content

Commit fe9bb2b

Browse files
authored
Merge pull request #5793 from HSLdevcom/AB#564
AB#564 validate shortName in route variant selector
2 parents 8e15126 + 1c5f1d1 commit fe9bb2b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

app/component/routepage/RoutePatternSelectContainer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import { routePagePath, PREFIX_STOPS } from '../../util/path';
1717
import RoutePatternSelect, { patternTextWithIcon } from './RoutePatternSelect';
1818

1919
function filterSimilarRoutes(routes, currentRoute) {
20-
const withoutCurrent = routes.filter(r => r.gtfsId !== currentRoute.gtfsId);
20+
const withoutCurrent = routes.filter(
21+
r => r.shortName && r.gtfsId !== currentRoute.gtfsId,
22+
);
2123

2224
let routeBasename = currentRoute.shortName;
2325
if (Number.isNaN(Number(routeBasename))) {
@@ -61,7 +63,7 @@ class RoutePatternSelectContainer extends Component {
6163

6264
fetchSimilarRoutes = route => {
6365
let searchSimilarTo = route.shortName;
64-
const c = route.shortName.length ? route.shortName[0] : '';
66+
const c = route.shortName?.length ? route.shortName[0] : '';
6567
if (c < '0' || c > '9') {
6668
// must start with number
6769
return;

0 commit comments

Comments
 (0)