forked from upstream-mirrors/OpenTracks
Bug: TrackStatistics cannot compute average moving speed (division by zero).
This commit is contained in:
@@ -261,7 +261,7 @@ public class TrackStatistics {
|
|||||||
* This calculation only takes into account the displacement until the last point that was accounted for in statistics.
|
* This calculation only takes into account the displacement until the last point that was accounted for in statistics.
|
||||||
*/
|
*/
|
||||||
public Speed getAverageSpeed() {
|
public Speed getAverageSpeed() {
|
||||||
if (totalDistance.isZero() && totalDistance.isZero()) {
|
if (totalTime.isZero()) {
|
||||||
return Speed.of(0);
|
return Speed.of(0);
|
||||||
}
|
}
|
||||||
return Speed.of(totalDistance.toM() / totalTime.getSeconds());
|
return Speed.of(totalDistance.toM() / totalTime.getSeconds());
|
||||||
|
|||||||
Reference in New Issue
Block a user