From 4bc076906f5a666fb8db013919695fea3c0d4ed3 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 25 Oct 2025 11:20:29 -0500 Subject: [PATCH] Add stricter coordinate validation in addMarker - Check if data object exists before accessing properties - Validate lat/lng are numbers, not just truthy values - Prevents TypeError when clustering tries to access undefined coordinates - Fixes: Error adding historical packet: TypeError: can't access property x of undefined --- assets/js/map.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/map.ts b/assets/js/map.ts index c95b5a9..0d20b34 100644 --- a/assets/js/map.ts +++ b/assets/js/map.ts @@ -1411,7 +1411,7 @@ let MapAPRSMap = { addMarker(data: MarkerData & { openPopup?: boolean }) { const self = this as unknown as LiveViewHookContext; const L = window.L; - if (!data.id || !data.lat || !data.lng) { + if (!data || !data.id || !data.lat || !data.lng || typeof data.lat !== 'number' || typeof data.lng !== 'number') { console.warn("Invalid marker data:", data); return; }