aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/protocol/UproProtocolDecoder.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/UproProtocolDecoder.java b/src/main/java/org/traccar/protocol/UproProtocolDecoder.java
index 05e6fd811..9f236a7e5 100644
--- a/src/main/java/org/traccar/protocol/UproProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/UproProtocolDecoder.java
@@ -307,7 +307,9 @@ public class UproProtocolDecoder extends BaseProtocolDecoder {
}
break;
case 'b':
- position.set("serial", data.toString(StandardCharsets.US_ASCII).substring(3));
+ if (data.readableBytes() > 3) {
+ position.set("serial", data.toString(StandardCharsets.US_ASCII).substring(3));
+ }
break;
default:
break;