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:
parent
0e985d5461
commit
b9940c510b
@ -15,7 +15,11 @@ public class FieldDefinitionCoordinate extends FieldDefinition {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object decode(ByteBuffer byteBuffer) {
|
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
|
@Override
|
||||||
|
@ -84,7 +84,7 @@ public class FitRecord extends RecordData {
|
|||||||
|
|
||||||
public ActivityPoint toActivityPoint() {
|
public ActivityPoint toActivityPoint() {
|
||||||
final ActivityPoint activityPoint = new ActivityPoint();
|
final ActivityPoint activityPoint = new ActivityPoint();
|
||||||
activityPoint.setTime(new Date(getComputedTimestamp()));
|
activityPoint.setTime(new Date(getComputedTimestamp() * 1000L));
|
||||||
if (getLatitude() != null && getLongitude() != null) {
|
if (getLatitude() != null && getLongitude() != null) {
|
||||||
activityPoint.setLocation(new GPSCoordinate(
|
activityPoint.setLocation(new GPSCoordinate(
|
||||||
getLongitude(),
|
getLongitude(),
|
||||||
|
Loading…
Reference in New Issue
Block a user