From 9841501b86a524996e4c3e5d6d282b1b53a5a6c2 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 30 May 2018 09:27:23 +0500 Subject: Use parser more correctly --- src/org/traccar/protocol/Gps103ProtocolDecoder.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') 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()); -- cgit v1.2.3