瀏覽代碼

handle storage manager null

release/3.x.x
vbBerni 5 年之前
父節點
當前提交
a9017b8795
共有 1 個檔案被更改,包括 8 行新增2 行删除
  1. +8
    -2
      Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs

+ 8
- 2
Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs 查看文件

@@ -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)


Loading…
取消
儲存