aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/DefaultDataHandler.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/org/traccar/DefaultDataHandler.java b/src/org/traccar/DefaultDataHandler.java
index cb35baceb..594961389 100644
--- a/src/org/traccar/DefaultDataHandler.java
+++ b/src/org/traccar/DefaultDataHandler.java
@@ -26,7 +26,7 @@ public class DefaultDataHandler extends BaseDataHandler {
try {
Context.getDataManager().addPosition(position);
Position lastPosition = Context.getConnectionManager().getLastPosition(position.getDeviceId());
- if (position.getFixTime().compareTo(lastPosition.getFixTime()) > 0) {
+ if (lastPosition == null || position.getFixTime().compareTo(lastPosition.getFixTime()) > 0) {
Context.getDataManager().updateLatestPosition(position);
}
} catch (Exception error) {