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
This commit is contained in:
Graham McIntire 2025-10-25 11:20:29 -05:00
parent 93902c043a
commit 4bc076906f
No known key found for this signature in database

View file

@ -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;
}