avoid NPE in getEstimatedSpeed

This commit is contained in:
Axel Uhl committed 2012-02-03 17:55:46 +01:00
1 parent 58d711be88
commit 6c1faa5a0b
1 file changed
+3 -2
@@ -309,9 +309,10 @@ public class GPSFixTrackImpl<ItemType, FixType extends GPSFix> extends TrackImpl
*/
@Override
public synchronized SpeedWithBearing getEstimatedSpeed(TimePoint at) {
return getEstimatedSpeed(at, getInternalFixes(), ConfidenceFactory.INSTANCE.createExponentialTimeDifferenceWeigher(
SpeedWithBearingWithConfidence<TimePoint> estimatedSpeed = getEstimatedSpeed(at, getInternalFixes(), ConfidenceFactory.INSTANCE.createExponentialTimeDifferenceWeigher(
// use a minimum confidence to avoid the bearing to flip to 270deg in case all is zero
getMillisecondsOverWhichToAverageSpeed())).getObject();
getMillisecondsOverWhichToAverageSpeed()));
return estimatedSpeed == null ? null : estimatedSpeed.getObject();
}
@Override