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