diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-10-21 16:48:08 +0400 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-10-21 16:48:08 +0400 |
commit | ca3f04d16c16d45d8753d6f84bf83ab8fc44446a (patch) | |
tree | fa2c15ca304d97385f5473ce08273431a7080365 /src/org/traccar | |
parent | 3c4bad1bf1705a94da5f3b74ed36baae66d5c1f1 (diff) | |
download | traccar-server-ca3f04d16c16d45d8753d6f84bf83ab8fc44446a.tar.gz traccar-server-ca3f04d16c16d45d8753d6f84bf83ab8fc44446a.tar.bz2 traccar-server-ca3f04d16c16d45d8753d6f84bf83ab8fc44446a.zip |
Handle empty values
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/GoSafeProtocolDecoder.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java index 760fcb2fd..06bd0873d 100644 --- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java +++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java @@ -70,7 +70,12 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder { private void decodeFragment(Position position, String fragment) { int dataIndex = fragment.indexOf(':'); int index = 0; - String[] values = fragment.substring(dataIndex + 1).split(";"); + String[] values; + if (fragment.length() == dataIndex + 1) { + values = new String[0]; + } else { + values = fragment.substring(dataIndex + 1).split(";"); + } switch (fragment.substring(0, dataIndex)) { case "GPS": position.setValid(values[index++].equals("A")); |