From fbc3bce5109ffa95491b792d4c7870167f9915ba Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sat, 8 Jul 2023 01:21:11 +0200 Subject: [PATCH] Fix: don't set invalid coordinates --- UI/Map/MapLibreAdaptor.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UI/Map/MapLibreAdaptor.ts b/UI/Map/MapLibreAdaptor.ts index 565d12abb..4b0c60e91 100644 --- a/UI/Map/MapLibreAdaptor.ts +++ b/UI/Map/MapLibreAdaptor.ts @@ -353,7 +353,11 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap { const center = map.getCenter() if (center.lng !== loc.lon || center.lat !== loc.lat) { - map.setCenter({ lng: loc.lon, lat: loc.lat }) + if (isNaN(loc.lon) || isNaN(loc.lat)) { + console.error("Got invalid lat or lon, not setting") + } else { + map.setCenter({ lng: loc.lon, lat: loc.lat }) + } } }