From 4efa341fd96eb20c2dc95144a2fd03f7601e2a02 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Fri, 10 Dec 2021 19:19:33 -0600 Subject: My fix failed, so I'm using try..catch instead --- src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index 46486227e..4481b61f2 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -396,13 +396,15 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { if (isHbm(deviceSession.getDeviceId())) { if (index < values.length) { - if (values[index + 1] != "") { + try { position.set(Position.KEY_HOURS, UnitsConverter.msFromMinutes(Integer.parseInt(values[index++]))); - } + } catch (NumberFormatException e) {} } if (index < values.length) { - position.set(Position.KEY_BATTERY, Double.parseDouble(values[index++])); + try { + position.set(Position.KEY_BATTERY, Double.parseDouble(values[index++])); + } catch (NumberFormatException e) {} } if (index < values.length && values[index++].equals("0")) { -- cgit v1.2.3