mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 11:45:43 +08:00
Improve performance.
This commit is contained in:
@@ -9,12 +9,17 @@ namespace MQTTnet.Protocol
|
||||
{
|
||||
if (applicationMessage == null) throw new ArgumentNullException(nameof(applicationMessage));
|
||||
|
||||
if (applicationMessage.TopicAlias > 0)
|
||||
if (!applicationMessage.TopicAlias.HasValue)
|
||||
{
|
||||
return;
|
||||
ThrowIfInvalid(applicationMessage.Topic);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (applicationMessage.TopicAlias.Value == 0)
|
||||
{
|
||||
throw new MqttProtocolViolationException("The topic alias cannot be 0.");
|
||||
}
|
||||
}
|
||||
|
||||
ThrowIfInvalid(applicationMessage.Topic);
|
||||
}
|
||||
|
||||
public static void ThrowIfInvalid(string topic)
|
||||
|
||||
Reference in New Issue
Block a user