aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java
index 0f815ca7b..ec4f97919 100644
--- a/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java
@@ -209,8 +209,12 @@ public class MictrackProtocolDecoder extends BaseProtocolDecoder {
}
private Object decodeLowAltitude(
- Channel channel, SocketAddress remoteAddress, String sentence) throws Exception {
- String deviceId = sentence.substring(0, sentence.indexOf("$"));
+ Channel channel, SocketAddress remoteAddress, String sentence) {
+ int separator = sentence.indexOf("$");
+ if (separator < 0) {
+ return null;
+ }
+ String deviceId = sentence.substring(0, separator);
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, deviceId);
if (deviceSession == null) {