Add explicit NaN checks to trail coordinate validation
Add isNaN() checks in addition to isFinite() to catch NaN values before they reach Leaflet's polyline renderer. This prevents 'can't access property x, h is undefined' errors when invalid coordinates slip through. Generated with Claude Code https://claude.com/claude-code
This commit is contained in:
parent
d68bbe28f0
commit
f94ac8097c
1 changed files with 4 additions and 0 deletions
|
|
@ -109,6 +109,8 @@ export class TrailManager {
|
|||
if (
|
||||
typeof lat !== 'number' ||
|
||||
typeof lng !== 'number' ||
|
||||
isNaN(lat) ||
|
||||
isNaN(lng) ||
|
||||
!isFinite(lat) ||
|
||||
!isFinite(lng) ||
|
||||
lat < -90 ||
|
||||
|
|
@ -278,6 +280,8 @@ export class TrailManager {
|
|||
pos &&
|
||||
typeof pos.lat === 'number' &&
|
||||
typeof pos.lng === 'number' &&
|
||||
!isNaN(pos.lat) &&
|
||||
!isNaN(pos.lng) &&
|
||||
isFinite(pos.lat) &&
|
||||
isFinite(pos.lng) &&
|
||||
pos.lat >= -90 &&
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue