From 56669ce1a869d7a1e2ebda0ecf1d38174026bab9 Mon Sep 17 00:00:00 2001 From: nativbarak Date: Wed, 7 Feb 2018 11:09:30 +0200 Subject: Fixed correct checks --- src/org/traccar/WebDataHandler.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/org/traccar') 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 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); -- cgit v1.2.3