aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/UproProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/UproProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/UproProtocolDecoder.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/UproProtocolDecoder.java b/src/org/traccar/protocol/UproProtocolDecoder.java
index c5b72ea0a..dc7a9200d 100644
--- a/src/org/traccar/protocol/UproProtocolDecoder.java
+++ b/src/org/traccar/protocol/UproProtocolDecoder.java
@@ -164,11 +164,13 @@ public class UproProtocolDecoder extends BaseProtocolDecoder {
position.set("statusExtended", data.toString(StandardCharsets.US_ASCII));
break;
case 'P':
- position.setNetwork(new Network(CellTower.from(
- Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII)),
- Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII)),
- Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII), 16),
- Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII), 16))));
+ if (data.readableBytes() >= 16) {
+ position.setNetwork(new Network(CellTower.from(
+ Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII)),
+ Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII)),
+ Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII), 16),
+ Integer.parseInt(data.readSlice(4).toString(StandardCharsets.US_ASCII), 16))));
+ }
break;
case 'Q':
position.set("obdPid", ByteBufUtil.hexDump(data));