diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-05-30 16:30:11 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-30 16:30:11 +1200 |
commit | 607123610018cdc1f0e391fec43e54e769d40a06 (patch) | |
tree | e6f092f385ba9dd8b9a9e8c5b33ed4c11ebfabb9 | |
parent | 6464535a57284d3243e715ee424e39e5834596cb (diff) | |
parent | 9841501b86a524996e4c3e5d6d282b1b53a5a6c2 (diff) | |
download | traccar-server-607123610018cdc1f0e391fec43e54e769d40a06.tar.gz traccar-server-607123610018cdc1f0e391fec43e54e769d40a06.tar.bz2 traccar-server-607123610018cdc1f0e391fec43e54e769d40a06.zip |
Merge pull request #3898 from Abyss777/engineHours_fix
Use parser more correctly
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 3d31326ae..9883079d1 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -254,9 +254,8 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, parser.nextInt(0)); parser.nextDouble(0); // instant fuel consumption position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble(0)); - Integer hours = parser.nextInt(); - if (hours != null) { - position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(hours)); + if (parser.hasNext()) { + position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(parser.nextInt())); } position.set(Position.KEY_OBD_SPEED, parser.nextInt(0)); position.set(Position.KEY_ENGINE_LOAD, parser.next()); |