Parcourir la source

handle storage manager null

release/3.x.x
vbBerni il y a 5 ans
Parent
révision
a9017b8795
1 fichiers modifiés avec 8 ajouts et 2 suppressions
  1. +8
    -2
      Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs

+ 8
- 2
Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs Voir le fichier

@@ -387,7 +387,10 @@ namespace MQTTnet.Extensions.ManagedClient
//removed it, in which case we don't want to do anything.
_messageQueue.RemoveFirst(i => i.Id.Equals(message.Id));
}
_storageManager?.RemoveAsync(message).GetAwaiter().GetResult();
if (_storageManager != null)
{
_storageManager.RemoveAsync(message).GetAwaiter().GetResult();
}
}
catch (MqttCommunicationException exception)
{
@@ -408,7 +411,10 @@ namespace MQTTnet.Extensions.ManagedClient
{
_messageQueue.RemoveFirst(i => i.Id.Equals(message.Id));
}
_storageManager?.RemoveAsync(message).GetAwaiter().GetResult();
if (_storageManager != null)
{
_storageManager.RemoveAsync(message).GetAwaiter().GetResult();
}
}
}
catch (Exception exception)


Chargement…
Annuler
Enregistrer