Skip to content

Commit 18746ae

Browse files
committed
Resolves #1
1 parent 2685af8 commit 18746ae

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Src/Xer.Messaginator.Extensions.MessageSources.Http/HttpMessageSource.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ internal HttpMessageSource(string url,
110110
.UseUrls(Url);
111111

112112
_host = ConfigureWebHost(webHostBuilder);
113+
114+
if (_host == null)
115+
{
116+
return Task.FromException(new InvalidOperationException("No web host was configured."));
117+
}
113118

114119
return _host.StartAsync(cancellationToken);
115120
}
@@ -121,7 +126,7 @@ internal HttpMessageSource(string url,
121126
/// <returns>Asynchronous task.</returns>
122127
public Task StopReceivingAsync(CancellationToken cancellationToken = default(CancellationToken))
123128
{
124-
return _host.StopAsync(cancellationToken);
129+
return _host?.StopAsync(cancellationToken);
125130
}
126131

127132
#endregion IMessageSource<TMessage> Implementation

0 commit comments

Comments
 (0)