mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-08-11 05:30:22 +02:00
better limits for min/max zoom validations, separate lat+lon validation, less verbose comments
This commit is contained in:
@@ -189,13 +189,10 @@ class GpsController {
|
||||
|
||||
/// Handle incoming GPS position
|
||||
void _onPositionReceived(Position position) {
|
||||
// Guard against malformed fixes from the platform location stack (some
|
||||
// OEM/fused location providers occasionally emit NaN/Infinite lat/lng,
|
||||
// especially while a fix is still being acquired). An unvalidated bad
|
||||
// value here can crash the app at launch (via initialCenter) or corrupt
|
||||
// the live map camera (via follow-me animateTo), so treat it like any
|
||||
// other transient location error rather than trusting it.
|
||||
if (!isValidCoordinate(position.latitude) || !isValidCoordinate(position.longitude)) {
|
||||
// Reject malformed fixes (occasionally NaN/Infinite from the platform
|
||||
// location stack) before they reach map state.
|
||||
if (!isValidLatitude(position.latitude) || !isValidLongitude(position.longitude)) {
|
||||
|
||||
debugPrint(
|
||||
'[GpsController] Ignoring invalid GPS position: '
|
||||
'lat=${position.latitude}, lng=${position.longitude}',
|
||||
|
||||
Reference in New Issue
Block a user