Skip to content

Commit 791ef5a

Browse files
committed
🐛 fix a bug
1 parent 5a82836 commit 791ef5a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

IOT-Guide-MQTT/src/main/java/iot/technology/mqtt/MqttTransportHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ private void processDevicePublish(ChannelHandlerContext ctx, MqttPublishMessage
108108
} else if (topicName.equals(MqttTopics.DEVICE_ATTRIBUTES_REQUEST_TOPIC_PREFIX)) {
109109
JsonMqttAdaptor.convertToMsg(GET_ATTRIBUTES_REQUEST, mqttMsg);
110110
}
111-
ctx.writeAndFlush(createMqttPubAckMsg(msgId));
111+
if (msgId > 0) {
112+
ctx.writeAndFlush(createMqttPubAckMsg(msgId));
113+
}
112114
} catch (AdaptorException e) {
113115
ctx.close();
114116
}
@@ -177,7 +179,7 @@ private void processUnsubscribe(ChannelHandlerContext ctx, MqttUnsubscribeMessag
177179
break;
178180

179181
}
180-
}catch (AdaptorException e) {
182+
} catch (AdaptorException e) {
181183

182184
}
183185
}

0 commit comments

Comments
 (0)