From 1580ad6d6e2fd20ba75438163b8c3eb65f62f174 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 12 Jun 2021 11:30:41 -0700 Subject: Fix tests --- src/main/java/org/traccar/protocol/UproProtocolDecoder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main') 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; -- cgit v1.2.3