aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java5
-rw-r--r--src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java4
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 2bfc08c75..ad7dfa886 100644
--- a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -179,6 +179,9 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
+
+ } else {
+ continue;
}
} else if (message.contains("$WIFI")) {
@@ -220,7 +223,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
positions.add(position);
}
- return positions;
+ return positions.isEmpty() ? null : positions;
}
}
diff --git a/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
index bc1c8e112..b747fa960 100644
--- a/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
@@ -11,6 +11,10 @@ public class Tlt2hProtocolDecoderTest extends ProtocolTest {
var decoder = new Tlt2hProtocolDecoder(null);
+ verifyNull(decoder, text(
+ "#860517049471362#MT700#0000#AUTO#1\r\n",
+ "#36$GPRMC,,V,,,,,,,,,,A*5C\r\n"));
+
verifyPositions(decoder, text(
"#867198059727390#MT700#0000#AUTO#1\r\n",
"#38$GPRMC,105721.00,A,2238.3071,N,11401.7575,E,,96.70,250321,,,A*74\r\n"));