aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index 15588c89b..ef09677bf 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -803,7 +803,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
}
- if (hasLbs(type)) {
+ if (hasLbs(type) && buf.readableBytes() > 6) {
decodeLbs(position, buf, type, hasStatus(type) && type != MSG_LBS_ALARM);
}
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index 9d0716c7d..23c29b0d3 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -17,6 +17,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"78780D01086471700328358100093F040D0A"));
+ verifyPosition(decoder, binary(
+ "78781511170103100e1f9904efe30400a97f88003410ffdd000d0a"));
+
verifyAttribute(decoder, binary(
"787819a5012ed0000075df000000000098661502050413000019a12b0d0a"),
Position.KEY_ALARM, Position.ALARM_TAMPERING);