diff options
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 7dcfdb200..9c1f5bee9 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -141,17 +141,23 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { switch (command) { case MSG_LOGIN: - response = ChannelBuffers.wrappedBuffer(new byte[] {0x01}); - sendResponse(channel, id, MSG_LOGIN_RESPONSE, response); + if (channel != null) { + response = ChannelBuffers.wrappedBuffer(new byte[] {0x01}); + sendResponse(channel, id, MSG_LOGIN_RESPONSE, response); + } return null; case MSG_HEARTBEAT: - response = ChannelBuffers.wrappedBuffer(new byte[] {0x01}); - sendResponse(channel, id, MSG_HEARTBEAT, response); + if (channel != null) { + response = ChannelBuffers.wrappedBuffer(new byte[] {0x01}); + sendResponse(channel, id, MSG_HEARTBEAT, response); + } return null; case MSG_SERVER: - response = ChannelBuffers.copiedBuffer( - getMeiligaoServer(channel), Charset.defaultCharset()); - sendResponse(channel, id, MSG_SERVER, response); + if (channel != null) { + response = ChannelBuffers.copiedBuffer( + getMeiligaoServer(channel), Charset.defaultCharset()); + sendResponse(channel, id, MSG_SERVER, response); + } return null; case MSG_POSITION: case MSG_POSITION_LOGGED: |