aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 5ff74e1f1..1c1dbba47 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -51,7 +51,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
"([NS])," +
"(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
"([EW])?," +
- "(\\d+\\.?\\d*)," + // Speed
+ "(\\d+\\.?\\d*)?,?" + // Speed
"(\\d+\\.?\\d*)?,?" + // Course
"(\\d+\\.?\\d*)?,?" + // Altitude
"([^,]+)?,?" +
@@ -155,8 +155,13 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(longitude);
// Speed
- position.setSpeed(Double.valueOf(parser.group(index++)));
-
+ String speed = parser.group(index++);
+ if (speed != null) {
+ position.setSpeed(Double.valueOf(speed));
+ } else {
+ position.setSpeed(0.0);
+ }
+
// Course
String course = parser.group(index++);
if (course != null) {