fixed PublishInternal
@@ -47,6 +47,10 @@ public class Mqtt5PublishInternal extends Mqtt5Message.Mqtt5MessageWithPropertie
final Mqtt5TopicAliasMapping topicAliasMapping =
channel.attr(ChannelAttributes.OUTGOING_TOPIC_ALIAS_MAPPING).get();
+ if (topicAliasMapping == null) {
+ this.topicAlias = DEFAULT_NO_TOPIC_ALIAS;
+ this.isNewTopicAlias = false;
+ } else {
final Mqtt5Topic topic = publish.getTopic();
final int topicAlias = topicAliasMapping.get(topic);
if (topicAlias != DEFAULT_NO_TOPIC_ALIAS) {
@@ -56,6 +60,7 @@ public class Mqtt5PublishInternal extends Mqtt5Message.Mqtt5MessageWithPropertie
this.topicAlias = topicAliasMapping.set(topic, publish.getTopicAliasUse());
this.isNewTopicAlias = this.topicAlias != DEFAULT_NO_TOPIC_ALIAS;
}
+ }
this.subscriptionIdentifiers = subscriptionIdentifiers;
}
