From b7145ea2e9d7efabb0d9806e76e7ac2995e56b27 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 20 Oct 2023 17:35:35 -0700 Subject: Fix DSM response handling --- .../java/org/traccar/protocol/DualcamProtocolDecoder.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main') 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; -- cgit v1.2.3