aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-06-12 11:30:41 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-06-12 11:30:41 -0700
commit1580ad6d6e2fd20ba75438163b8c3eb65f62f174 (patch)
treeba71f0a8794b4ca93580e9aa7daff462e3f85bdd /src
parentb0786045260de09048212a6dae8e5c11f23f6813 (diff)
downloadtraccar-server-1580ad6d6e2fd20ba75438163b8c3eb65f62f174.tar.gz
traccar-server-1580ad6d6e2fd20ba75438163b8c3eb65f62f174.tar.bz2
traccar-server-1580ad6d6e2fd20ba75438163b8c3eb65f62f174.zip
Fix tests
Diffstat (limited to 'src')
-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;