mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-25 15:42:57 +08:00
Add validation for topics before publishing.
This commit is contained in:
@@ -166,6 +166,8 @@ namespace MQTTnet.Client
|
||||
{
|
||||
if (applicationMessage == null) throw new ArgumentNullException(nameof(applicationMessage));
|
||||
|
||||
MqttTopicValidator.ThrowIfInvalid(applicationMessage.Topic);
|
||||
|
||||
ThrowIfNotConnected();
|
||||
|
||||
var publishPacket = _adapter.PacketFormatterAdapter.DataConverter.CreatePublishPacket(applicationMessage);
|
||||
|
||||
Reference in New Issue
Block a user