fix: getMslAltitudeMeters call when MSL altitude is not available

This commit is contained in:
andrekir 2024-06-16 07:55:22 -03:00
parent d4f4e4f14a
commit e5396524fb

View file

@ -181,7 +181,9 @@ class MeshService : Service(), Logging {
position {
latitudeI = Position.degI(location.latitude)
longitudeI = Position.degI(location.longitude)
altitude = LocationCompat.getMslAltitudeMeters(location).toInt()
if (LocationCompat.hasMslAltitude(location)) {
altitude = LocationCompat.getMslAltitudeMeters(location).toInt()
}
altitudeHae = location.altitude.toInt()
time = (location.time / 1000).toInt()
groundSpeed = location.speed.toInt()