From 901c331745c8aed5593ca80f3faff5ee4d06d2a8 Mon Sep 17 00:00:00 2001 From: Kevin Goos Date: Fri, 16 Mar 2018 12:13:02 +0100 Subject: Added null check --- src/org/traccar/protocol/LaipacSFKamelProtocolDecoder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/protocol') 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; } -- cgit v1.2.3