diff options
author | Evgeny S Maksimov <me@vragam.net> | 2018-12-17 12:12:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-17 12:12:56 +0300 |
commit | 132b3b21bb7f56fa880a7024d581f36b98b78a7f (patch) | |
tree | e14b1297358c78b8cf3cb8cdbaaf84394faacd04 /src/org | |
parent | 4e9ab9892ac2712914a7d6ab865f6255bfcd2218 (diff) | |
download | traccar-server-132b3b21bb7f56fa880a7024d581f36b98b78a7f.tar.gz traccar-server-132b3b21bb7f56fa880a7024d581f36b98b78a7f.tar.bz2 traccar-server-132b3b21bb7f56fa880a7024d581f36b98b78a7f.zip |
Added check of the group parameter.
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/WebDataHandler.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java index 49033fc3a..c7ce7485d 100644 --- a/src/org/traccar/WebDataHandler.java +++ b/src/org/traccar/WebDataHandler.java @@ -140,16 +140,19 @@ public class WebDataHandler extends BaseDataHandler { request = request.replace("{gprmc}", formatSentence(position)); } - String deviceGroupName = ""; - - if (device.getGroupId() != 0) { - Group group = Context.getGroupsManager().getById(device.getGroupId()); - if (group != null) { + if (request.contains("{group}")) { + String deviceGroupName = ""; + if (device.getGroupId() != 0) { + Group group = Context.getGroupsManager().getById(device.getGroupId()); + if (group != null) { deviceGroupName = group.getName(); + } } + + request = request.replace("{group}", URLEncoder.encode(deviceGroupName, StandardCharsets.UTF_8.name())); } - return request.replace("{group}", URLEncoder.encode(deviceGroupName, StandardCharsets.UTF_8.name())); + return request; } @Override |