Bug: TrackStatistics cannot compute average moving speed (division by zero).

This commit is contained in:
Dennis Guse
2023-06-22 23:24:54 +02:00
parent 77719f5bcd
commit fc2341515c
@@ -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.
*/
public Speed getAverageSpeed() {
if (totalDistance.isZero() && totalDistance.isZero()) {
if (totalTime.isZero()) {
return Speed.of(0);
}
return Speed.of(totalDistance.toM() / totalTime.getSeconds());