aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/H02FrameDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/H02FrameDecoder.java')
-rw-r--r--src/org/traccar/protocol/H02FrameDecoder.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/H02FrameDecoder.java b/src/org/traccar/protocol/H02FrameDecoder.java
index 0e3f78737..ce27b406f 100644
--- a/src/org/traccar/protocol/H02FrameDecoder.java
+++ b/src/org/traccar/protocol/H02FrameDecoder.java
@@ -49,12 +49,10 @@ public class H02FrameDecoder extends FrameDecoder {
return buf.readBytes(index + 1 - buf.readerIndex());
}
- } else if (marker.equals("$")) {
+ } else if (marker.equals("$") && buf.readableBytes() >= MESSAGE_LENGTH) {
// Return binary message
- if (buf.readableBytes() >= MESSAGE_LENGTH) {
- return buf.readBytes(MESSAGE_LENGTH);
- }
+ return buf.readBytes(MESSAGE_LENGTH);
}