diff options
Diffstat (limited to 'src/org/traccar/protocol/Tr20ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Tr20ProtocolDecoder.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java index 8f2f49218..0424b70b0 100644 --- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java @@ -22,6 +22,7 @@ import java.util.regex.Pattern; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.GenericProtocolDecoder; +import org.traccar.helper.Log; import org.traccar.model.DataManager; import org.traccar.model.Position; @@ -91,7 +92,12 @@ public class Tr20ProtocolDecoder extends GenericProtocolDecoder { // Get device by id String id = parser.group(index++); - position.setDeviceId(getDataManager().getDeviceByImei(id).getId()); + try { + position.setDeviceId(getDataManager().getDeviceByImei(id).getId()); + } catch(Exception error) { + Log.warning("Unknown device - " + id); + return null; + } // Validity position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); |