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:
parent
93902c043a
commit
4bc076906f
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue