diff --git a/MQTTnet.Core/Server/MqttClientRetainedMessagesManager.cs b/MQTTnet.Core/Server/MqttClientRetainedMessagesManager.cs index f962a1a..b12da00 100644 --- a/MQTTnet.Core/Server/MqttClientRetainedMessagesManager.cs +++ b/MQTTnet.Core/Server/MqttClientRetainedMessagesManager.cs @@ -20,6 +20,11 @@ namespace MQTTnet.Core.Server public async Task LoadMessagesAsync() { + if (_options.Storage == null) + { + return; + } + try { var retainedMessages = await _options.Storage.LoadRetainedMessagesAsync();