Bläddra i källkod

Fix.

release/3.x.x
PMExtra 4 år sedan
förälder
incheckning
aafd4ea658
2 ändrade filer med 2 tillägg och 2 borttagningar
  1. +1
    -1
      Build/MQTTnet.nuspec
  2. +1
    -1
      Source/MQTTnet/Extensions/UserPropertyExtension.cs

+ 1
- 1
Build/MQTTnet.nuspec Visa fil

@@ -22,7 +22,7 @@
* [Server] Added interceptor for unsubscriptions.
* [MQTTnet.Server] Added interceptor for unsubscriptions.
* [MQTTnet.AspNetCore] improved compatibility with AspNetCore 3.1
* [MqttApplicationMessage] Added GetUserProperty<T> convenience method (thanks to @PMExtra).
* [Core] Added MqttApplicationMessage.GetUserProperty&lt;T&gt;() convenience method (thanks to @PMExtra).
</releaseNotes>
<copyright>Copyright Christian Kratky 2016-2019</copyright>
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags>


+ 1
- 1
Source/MQTTnet/Extensions/UserPropertyExtension.cs Visa fil

@@ -7,7 +7,7 @@ namespace MQTTnet.Extensions
{
public static string GetUserProperty(this MqttApplicationMessage message, string propertyName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
{
return message.UserProperties.SingleOrDefault(up => up.Name.Equals(propertyName, comparisonType))?.Value;
return message?.UserProperties?.SingleOrDefault(up => up.Name.Equals(propertyName, comparisonType))?.Value;
}

public static T GetUserProperty<T>(this MqttApplicationMessage message, string propertyName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)


Laddar…
Avbryt
Spara