Merged in fix/nullcheck-gethotelpins (pull request #1296)

fix: getHotelPins - null check on hotelData

* fix: getHotelPins - null check on hotelData


Approved-by: Pontus Dreij
This commit is contained in:
Linus Flood
2025-02-10 15:11:39 +00:00
parent c863294919
commit a86f0f3993

View File

@@ -4,7 +4,9 @@ import type { HotelPin } from "@/types/components/hotelReservation/selectHotel/m
export function getHotelPins(hotels: HotelData[]): HotelPin[] { export function getHotelPins(hotels: HotelData[]): HotelPin[] {
if (hotels.length === 0) return [] if (hotels.length === 0) return []
return hotels.map((hotel) => ({ return hotels
.filter((hotel) => hotel.hotelData)
.map((hotel) => ({
coordinates: { coordinates: {
lat: hotel.hotelData.location.latitude, lat: hotel.hotelData.location.latitude,
lng: hotel.hotelData.location.longitude, lng: hotel.hotelData.location.longitude,