diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/reports/SummaryReportProvider.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/reports/SummaryReportProvider.java b/src/main/java/org/traccar/reports/SummaryReportProvider.java index 5bd7e51b3..955f07dd9 100644 --- a/src/main/java/org/traccar/reports/SummaryReportProvider.java +++ b/src/main/java/org/traccar/reports/SummaryReportProvider.java @@ -108,8 +108,10 @@ public class SummaryReportProvider { if (first.hasAttribute(Position.KEY_HOURS) && last.hasAttribute(Position.KEY_HOURS)) { result.setStartHours(first.getLong(Position.KEY_HOURS)); result.setEndHours(last.getLong(Position.KEY_HOURS)); - result.setAverageSpeed(UnitsConverter.knotsFromMps( - result.getDistance() * 1000 / result.getEngineHours())); + long engineHours = result.getEngineHours(); + if (engineHours > 0) { + result.setAverageSpeed(UnitsConverter.knotsFromMps(result.getDistance() * 1000 / engineHours)); + } } if (!ignoreOdometer |