diff --git a/src/src/app/components/trip/trip.component.ts b/src/src/app/components/trip/trip.component.ts index 07743ac..55c6d1a 100644 --- a/src/src/app/components/trip/trip.component.ts +++ b/src/src/app/components/trip/trip.component.ts @@ -496,9 +496,11 @@ export class TripComponent implements AfterViewInit { resetMapBounds() { if (!this.places.length) { if (!this.trip?.days.length) return; + const itemsWithCoordinates = this.flattenedTripItems.filter((i) => i.lat != null && i.lng != null); + if (!itemsWithCoordinates.length) return; this.map?.fitBounds( - this.flattenedTripItems.filter((i) => i.lat != null && i.lng != null).map((i) => [i.lat!, i.lng!]), + itemsWithCoordinates.map((i) => [i.lat!, i.lng!]), { padding: [30, 30] }, ); return;