Skip to content

fix: NaN coordinates crash — Invalid LatLng object: (NaN, NaN)#828

Merged
accius merged 1 commit intomainfrom
Staging
Mar 24, 2026
Merged

fix: NaN coordinates crash — Invalid LatLng object: (NaN, NaN)#828
accius merged 1 commit intomainfrom
Staging

Conversation

@accius
Copy link
Owner

@accius accius commented Mar 24, 2026

NaN != null is true, so all null-checks let NaN coordinates through to Leaflet which crashes with "Invalid LatLng object: (NaN, NaN)".

Server: sanitize coordinates with Number.isFinite() before sending — NaN from bad grid lookups or prefix estimates now becomes null.

Frontend: replaced all spot/path coordinate guards from
spot.lat != null → Number.isFinite(spot.lat)
in WorldMap.jsx (placeSpots, DX paths) and AzimuthalMap.jsx (POTA, WWFF, SOTA, WWBOTA, DX marker, spotter paths).

Credit: Alan (alanhargreaves) caught this.

What does this PR do?

Type of change

  • Bug fix
  • New feature
  • Performance improvement
  • Refactor / code cleanup
  • Documentation
  • Translation
  • Map layer plugin

How to test

Checklist

  • App loads without console errors
  • Tested in Dark, Light, and Retro themes
  • Responsive at different screen sizes (desktop + mobile)
  • If touching server.js: caches have TTLs and size caps (we serve 2,000+ concurrent users)
  • If adding an API route: includes caching and error handling
  • If adding a panel: wired into Modern, Classic, and Dockable layouts
  • No hardcoded colors — uses CSS variables (var(--accent-cyan), etc.)
  • No .bak, .old, console.log debug lines, or test scripts included

Screenshots (if visual change)

NaN != null is true, so all null-checks let NaN coordinates through
to Leaflet which crashes with "Invalid LatLng object: (NaN, NaN)".

Server: sanitize coordinates with Number.isFinite() before sending
— NaN from bad grid lookups or prefix estimates now becomes null.

Frontend: replaced all spot/path coordinate guards from
  spot.lat != null  →  Number.isFinite(spot.lat)
in WorldMap.jsx (placeSpots, DX paths) and AzimuthalMap.jsx
(POTA, WWFF, SOTA, WWBOTA, DX marker, spotter paths).

Credit: Alan (alanhargreaves) caught this.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@accius accius merged commit ab90f56 into main Mar 24, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant