aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2018-05-30 09:27:23 +0500
committerAbyss777 <abyss@fox5.ru>2018-05-30 09:27:23 +0500
commit9841501b86a524996e4c3e5d6d282b1b53a5a6c2 (patch)
treee6f092f385ba9dd8b9a9e8c5b33ed4c11ebfabb9
parent6464535a57284d3243e715ee424e39e5834596cb (diff)
downloadtraccar-server-9841501b86a524996e4c3e5d6d282b1b53a5a6c2.tar.gz
traccar-server-9841501b86a524996e4c3e5d6d282b1b53a5a6c2.tar.bz2
traccar-server-9841501b86a524996e4c3e5d6d282b1b53a5a6c2.zip
Use parser more correctly
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java5
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());