From a789d3992ec5c5918a122c284fe46e4f1e26b746 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 13 Nov 2018 10:09:06 +1300 Subject: Handle ST600 empty values --- src/org/traccar/protocol/SuntechProtocolDecoder.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index 48eb3a71d..ad1da537b 100644 --- a/src/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java @@ -317,9 +317,11 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { } if (includeAdc) { - position.set(Position.PREFIX_ADC + 1, Double.parseDouble(values[index++])); - position.set(Position.PREFIX_ADC + 2, Double.parseDouble(values[index++])); - position.set(Position.PREFIX_ADC + 3, Double.parseDouble(values[index++])); + for (int i = 1; i <= 3; i++) { + if (!values[index++].isEmpty()) { + position.set(Position.PREFIX_ADC + i, Double.parseDouble(values[index - 1])); + } + } } if (values.length - index >= 2) { -- cgit v1.2.3