Skip to content

Commit

Permalink
Use parser more correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Abyss777 committed May 30, 2018
1 parent 6464535 commit 9841501
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/org/traccar/protocol/Gps103ProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,8 @@ private Position decodeObd(Channel channel, SocketAddress remoteAddress, String
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());
Expand Down

0 comments on commit 9841501

Please sign in to comment.