From 95fd9aa443dd350cf557153f3c5189bfac95f781 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sun, 12 Oct 2025 14:58:39 -0500 Subject: [PATCH] fix: fix Leaflet polyline error and add coordinate validation - Fix typo: bindTooltip -> bindTooltip in RF path visualization - Add coordinate validation before creating polylines - Check initial station coordinates are finite numbers - Validate each path station's coordinates - Skip invalid coordinates with console warning - Prevents "can't access property 'x', h is undefined" error --- assets/js/map.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/assets/js/map.ts b/assets/js/map.ts index 07c7f86..206d9fb 100644 --- a/assets/js/map.ts +++ b/assets/js/map.ts @@ -1186,6 +1186,12 @@ let MapAPRSMap = { }) => { if (!self.map || !data.path_stations || data.path_stations.length === 0) return; + // Validate initial station coordinates + if (!isFinite(data.station_lat) || !isFinite(data.station_lng)) { + console.warn("Invalid initial station coordinates for RF path:", { lat: data.station_lat, lng: data.station_lng }); + return; + } + // Clear any existing path lines if (self.rfPathLines) { self.rfPathLines.forEach((line) => self.map!.removeLayer(line)); @@ -1197,6 +1203,12 @@ let MapAPRSMap = { let prevLng = data.station_lng; data.path_stations.forEach((station, index) => { + // Validate coordinates before drawing + if (!isFinite(prevLat) || !isFinite(prevLng) || !isFinite(station.lat) || !isFinite(station.lng)) { + console.warn("Invalid coordinates for RF path:", { prevLat, prevLng, station }); + return; + } + // Draw line from previous position to this station const line = L.polyline( [