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:
Graham McIntire 2025-10-25 12:08:31 -05:00
parent d68bbe28f0
commit f94ac8097c
No known key found for this signature in database

View file

@ -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 &&