From 7ed27b733d442cb442a8049263fab282b39e5872 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 8 May 2016 11:13:34 +1200 Subject: Handle GT06 empty string message (fix #1930) --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index 18524fcfa..6dc382a04 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -214,9 +214,10 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { int commandLength = buf.readUnsignedByte(); - buf.readUnsignedByte(); // server flag (reserved) - - position.set("command", buf.readBytes(commandLength - 1).toString(StandardCharsets.US_ASCII)); + if (commandLength > 0) { + buf.readUnsignedByte(); // server flag (reserved) + position.set("command", buf.readBytes(commandLength - 1).toString(StandardCharsets.US_ASCII)); + } buf.readUnsignedShort(); // language -- cgit v1.2.3