diff options
author | Kevin Goos <kevin.goos@infrabel.be> | 2018-03-16 12:13:02 +0100 |
---|---|---|
committer | Kevin Goos <kevin.goos@infrabel.be> | 2018-03-16 12:13:02 +0100 |
commit | 901c331745c8aed5593ca80f3faff5ee4d06d2a8 (patch) | |
tree | 644232982eb111a0a50dea802a57c30784eb7832 /src/org | |
parent | 9c13bf44cd83c3d2489b763a6c5af6d04d26ad48 (diff) | |
download | trackermap-server-901c331745c8aed5593ca80f3faff5ee4d06d2a8.tar.gz trackermap-server-901c331745c8aed5593ca80f3faff5ee4d06d2a8.tar.bz2 trackermap-server-901c331745c8aed5593ca80f3faff5ee4d06d2a8.zip |
Added null check
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/protocol/LaipacSFKamelProtocolDecoder.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/LaipacSFKamelProtocolDecoder.java b/src/org/traccar/protocol/LaipacSFKamelProtocolDecoder.java index 0d3995144..dc169c668 100644 --- a/src/org/traccar/protocol/LaipacSFKamelProtocolDecoder.java +++ b/src/org/traccar/protocol/LaipacSFKamelProtocolDecoder.java @@ -118,8 +118,9 @@ public class LaipacSFKamelProtocolDecoder extends BaseProtocolDecoder { checksum = parser.next(); } + String result = sentence.replaceAll("^\\$(.*)\\*[0-9a-fA-F]{2}$", "$1"); - if (Integer.parseInt(checksum, 16) != Checksum.xor(result)) + if (checksum == null || Integer.parseInt(checksum, 16) != Checksum.xor(result)) { return null; } |