fix: error when rendering null alternates

This commit is contained in:
2025-06-27 14:29:09 +02:00
parent d0bb393b5b
commit 03622dba04

View File

@@ -90,11 +90,13 @@
]); ]);
const res = await fetchRoute(ROUTING_SERVER, req); const res = await fetchRoute(ROUTING_SERVER, req);
routes = [res.trip]; routes = [res.trip];
if(res.alternates) {
for (const alternate of res.alternates) { for (const alternate of res.alternates) {
if (alternate.trip) { if (alternate.trip) {
routes.push(alternate.trip); routes.push(alternate.trip);
} }
} }
}
drawAllRoutes(routes); drawAllRoutes(routes);
zoomToPoints(FROM, TO, map.value!); zoomToPoints(FROM, TO, map.value!);
}}>Calculate</Button }}>Calculate</Button