aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-08-06 20:29:27 -0700
committerAnton Tananaev <anton@traccar.org>2022-08-06 20:29:27 -0700
commit890ecacae6a442ae2b8d4a0e0e2acd4f3e052135 (patch)
tree158783c7b64e1adb31b8ac1278c0aa1433670441
parent074cc52c3d645ac974a1489aa4e197d471093403 (diff)
downloadtrackermap-server-890ecacae6a442ae2b8d4a0e0e2acd4f3e052135.tar.gz
trackermap-server-890ecacae6a442ae2b8d4a0e0e2acd4f3e052135.tar.bz2
trackermap-server-890ecacae6a442ae2b8d4a0e0e2acd4f3e052135.zip
Handle unknown device (fix #4917)
-rw-r--r--src/main/java/org/traccar/protocol/WondexProtocolDecoder.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/WondexProtocolDecoder.java b/src/main/java/org/traccar/protocol/WondexProtocolDecoder.java
index 22d7bade3..46aa65a5d 100644
--- a/src/main/java/org/traccar/protocol/WondexProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/WondexProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,6 +74,9 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
|| buf.toString(StandardCharsets.US_ASCII).startsWith("$MSG:")) {
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress);
+ if (deviceSession == null) {
+ return null;
+ }
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
@@ -89,12 +92,12 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- Position position = new Position(getProtocolName());
-
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
if (deviceSession == null) {
return null;
}
+
+ Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
position.setTime(parser.nextDateTime());