diff options
-rw-r--r-- | src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java | 11 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/DualcamProtocolDecoderTest.java | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java index 5a6425e7e..f6712d7f2 100644 --- a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java @@ -138,10 +138,13 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder { break; case MSG_PATH_RESPONSE: String file = buf.readCharSequence(buf.readUnsignedShort(), StandardCharsets.US_ASCII).toString(); - ByteBuf response = Unpooled.buffer(); - response.writeShort(MSG_FILE_REQUEST); - response.writeShort(file.length()); - response.writeCharSequence(file, StandardCharsets.US_ASCII); + if (channel != null) { + ByteBuf response = Unpooled.buffer(); + response.writeShort(MSG_FILE_REQUEST); + response.writeShort(file.length()); + response.writeCharSequence(file, StandardCharsets.US_ASCII); + channel.writeAndFlush(new NetworkMessage(response, remoteAddress)); + } break; default: break; diff --git a/src/test/java/org/traccar/protocol/DualcamProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/DualcamProtocolDecoderTest.java index de70e2b63..e1c31fc47 100644 --- a/src/test/java/org/traccar/protocol/DualcamProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/DualcamProtocolDecoderTest.java @@ -14,6 +14,9 @@ public class DualcamProtocolDecoderTest extends ProtocolTest { "000000050001403a4abaa31444000400")); verifyNull(decoder, binary( + "000d001e64736d2f706963747572652f3233313032302f3233313435322e6a706700")); + + verifyNull(decoder, binary( "00010006000000110000")); verifyNull(decoder, binary( |