1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 04:46:51 +01:00

Garmin: Fix crash on decoding null gps coordinates

This commit is contained in:
José Rebelo 2024-08-17 19:47:34 +01:00
parent 0e985d5461
commit b9940c510b
2 changed files with 6 additions and 2 deletions

View File

@ -15,7 +15,11 @@ public class FieldDefinitionCoordinate extends FieldDefinition {
@Override
public Object decode(ByteBuffer byteBuffer) {
return ((long) baseType.decode(byteBuffer, 1, 0)) * conversionFactor;
final Object rawValue = baseType.decode(byteBuffer, 1, 0);
if (rawValue == null) {
return null;
}
return ((long) rawValue) * conversionFactor;
}
@Override

View File

@ -84,7 +84,7 @@ public class FitRecord extends RecordData {
public ActivityPoint toActivityPoint() {
final ActivityPoint activityPoint = new ActivityPoint();
activityPoint.setTime(new Date(getComputedTimestamp()));
activityPoint.setTime(new Date(getComputedTimestamp() * 1000L));
if (getLatitude() != null && getLongitude() != null) {
activityPoint.setLocation(new GPSCoordinate(
getLongitude(),