aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/OverspeedEventHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/events/OverspeedEventHandler.java')
-rw-r--r--src/org/traccar/events/OverspeedEventHandler.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/org/traccar/events/OverspeedEventHandler.java b/src/org/traccar/events/OverspeedEventHandler.java
index fd005e170..6c9b523f4 100644
--- a/src/org/traccar/events/OverspeedEventHandler.java
+++ b/src/org/traccar/events/OverspeedEventHandler.java
@@ -44,15 +44,14 @@ public class OverspeedEventHandler extends BaseEventHandler {
if (device == null) {
return null;
}
- if (position.getId() != device.getPositionId() || !position.getValid()) {
+ if (!Context.getDeviceManager().isLatestPosition(position) || !position.getValid()) {
return null;
}
Collection<Event> events = new ArrayList<>();
double speed = position.getSpeed();
- boolean valid = position.getValid();
- if (valid && globalSpeedLimit != 0 && speed > globalSpeedLimit) {
+ if (globalSpeedLimit != 0 && speed > globalSpeedLimit) {
try {
if (Context.getDataManager().getLastEvents(
position.getDeviceId(), Event.TYPE_DEVICE_OVERSPEED, suppressRepeated).isEmpty()) {