From 706de3e02cde8daa0bce29dd2ff96703f17ff92a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 27 Sep 2022 08:37:44 -0700 Subject: Better PID decoding error --- src/main/java/org/traccar/protocol/CastelProtocolDecoder.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main/java/org/traccar/protocol') diff --git a/src/main/java/org/traccar/protocol/CastelProtocolDecoder.java b/src/main/java/org/traccar/protocol/CastelProtocolDecoder.java index c2b740c4c..4aa65245b 100644 --- a/src/main/java/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/CastelProtocolDecoder.java @@ -160,6 +160,9 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { for (int i = 0; i < count; i++) { int value; + if (!PID_LENGTH_MAP.containsKey(pids[i])) { + throw new RuntimeException(String.format("Unknown PID 0x%02x", pids[i])); + } switch (PID_LENGTH_MAP.get(pids[i])) { case 1: value = buf.readUnsignedByte(); -- cgit v1.2.3