aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/WebDataHandler.java13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java
index 5a0aab3e4..f7a7222d8 100644
--- a/src/org/traccar/WebDataHandler.java
+++ b/src/org/traccar/WebDataHandler.java
@@ -146,17 +146,10 @@ public class WebDataHandler extends BaseDataHandler {
protected String prepareJsonPayload(Position position) {
Map<String, Object> data = new HashMap<>();
+ Device device = Context.getIdentityManager().getById(position.getDeviceId());
- if (position != null) {
- data.put(KEY_POSITION, position);
- }
-
- if (position.getDeviceId() != 0) {
- Device device = Context.getIdentityManager().getById(position.getDeviceId());
- if (device != null) {
- data.put(KEY_DEVICE, device);
- }
- }
+ data.put(KEY_POSITION, position);
+ data.put(KEY_DEVICE, device);
try {
return Context.getObjectMapper().writeValueAsString(data);