diff options
author | Iván Ávalos <avalos@disroot.org> | 2021-12-10 19:19:33 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2021-12-10 19:19:33 -0600 |
commit | 4efa341fd96eb20c2dc95144a2fd03f7601e2a02 (patch) | |
tree | 922c7bc75a0b3a75d8e4dc42097cb489bf8d1770 | |
parent | 6819ae24344f707c654f295bf02fbd64f9f59289 (diff) | |
download | traccar-server-4efa341fd96eb20c2dc95144a2fd03f7601e2a02.tar.gz traccar-server-4efa341fd96eb20c2dc95144a2fd03f7601e2a02.tar.bz2 traccar-server-4efa341fd96eb20c2dc95144a2fd03f7601e2a02.zip |
My fix failed, so I'm using try..catch instead
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 8 |
1 files changed, 5 insertions, 3 deletions
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")) { |