diff options
Diffstat (limited to 'src/org/traccar/protocol/Gt02ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gt02ProtocolDecoder.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java index 5d082e381..76756f41d 100644 --- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java @@ -18,11 +18,9 @@ package org.traccar.protocol; import java.net.SocketAddress; import java.util.Calendar; import java.util.TimeZone; - import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; - import org.traccar.BaseProtocolDecoder; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; @@ -68,13 +66,13 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { int type = buf.readUnsignedByte(); if (type == MSG_HEARTBEAT) { + if (channel != null) { byte[] response = {0x54, 0x68, 0x1A, 0x0D, 0x0A}; channel.write(ChannelBuffers.wrappedBuffer(response)); } - } - else if (type == MSG_DATA) { + } else if (type == MSG_DATA) { // Create new position Position position = new Position(); |