aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2018-08-23 10:10:44 +0500
committerAbyss777 <abyss@fox5.ru>2018-08-23 10:10:44 +0500
commite7d5dae5af7214f7f8dac39e8d081ad6c4533d20 (patch)
treeb9b7780bcbccf9c79f1ac610779f8175b69451f0 /src/org/traccar/database
parent12bb168b88fc3dbcdf59c2fec1a919e20ab57838 (diff)
downloadtraccar-server-e7d5dae5af7214f7f8dac39e8d081ad6c4533d20.tar.gz
traccar-server-e7d5dae5af7214f7f8dac39e8d081ad6c4533d20.tar.bz2
traccar-server-e7d5dae5af7214f7f8dac39e8d081ad6c4533d20.zip
Make accumulators nullable
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/DeviceManager.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java
index c32aca6f9..bc8894743 100644
--- a/src/org/traccar/database/DeviceManager.java
+++ b/src/org/traccar/database/DeviceManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -354,8 +354,12 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
public void resetDeviceAccumulators(DeviceAccumulators deviceAccumulators) throws SQLException {
Position last = positions.get(deviceAccumulators.getDeviceId());
if (last != null) {
- last.getAttributes().put(Position.KEY_TOTAL_DISTANCE, deviceAccumulators.getTotalDistance());
- last.getAttributes().put(Position.KEY_HOURS, deviceAccumulators.getHours());
+ if (deviceAccumulators.getTotalDistance() != null) {
+ last.getAttributes().put(Position.KEY_TOTAL_DISTANCE, deviceAccumulators.getTotalDistance());
+ }
+ if (deviceAccumulators.getHours() != null) {
+ last.getAttributes().put(Position.KEY_HOURS, deviceAccumulators.getHours());
+ }
getDataManager().addObject(last);
updateLatestPosition(last);
} else {