From f7a739e1625f1d443f4d50cc3f4055818c8544e7 Mon Sep 17 00:00:00 2001 From: Christian <6939810+chkr1011@users.noreply.github.com> Date: Tue, 12 Jul 2022 12:02:00 +0200 Subject: [PATCH] Fix check for skipped application messages. --- .github/workflows/ReleaseNotes.md | 1 + Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ReleaseNotes.md b/.github/workflows/ReleaseNotes.md index 547962a8..897cf698 100644 --- a/.github/workflows/ReleaseNotes.md +++ b/.github/workflows/ReleaseNotes.md @@ -1,6 +1,7 @@ * [Core] Updated nuget packages. * [Core] The option _IgnoreCertificateChainErrors_ is now respected (thanks to @GodVenn, #1447). * [ManagedClient] The managed client now sends the entire topic filter including new MQTTv5 properties when subscribing. +* [ManagedClient] Fixed wrong firing of _ApplicationMessageSkippedAsync_ event (thanks to @quackgizmo, #1460). * [Server] Fixed reporting of _MaximumQoS_ in _ConnAck_ packet (MQTTv5 only) (#1442). * [Server] Fix cross thread issue in session message storage for QoS 1 and 2. * [Server] The event _ClientSubscribedTopicAsync_ is now fired after the subscription is completely processed internally (#1435). diff --git a/Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs b/Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs index b71c94a1..b4fa02c2 100644 --- a/Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs +++ b/Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs @@ -201,7 +201,7 @@ namespace MQTTnet.Extensions.ManagedClient } finally { - if (_applicationMessageSkippedEvent.HasHandlers) + if (applicationMessageSkippedEventArgs != null && _applicationMessageSkippedEvent.HasHandlers) { await _applicationMessageSkippedEvent.InvokeAsync(applicationMessageSkippedEventArgs).ConfigureAwait(false); }