Skip to content

Commit 1ca3ead

Browse files
authored
Fix null exception when connection fails to start (#215)
* Fix null exception when connection fails to start * Update ConnectionFactory.cs * Update ServiceHubDispatcher.cs
1 parent e88fa07 commit 1ca3ead

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Microsoft.Azure.SignalR.AspNet/Infrastructure/ConnectionFactory.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ public async Task<ConnectionContext> ConnectAsync(TransferFormat transferFormat,
7575

7676
public Task DisposeAsync(ConnectionContext connection)
7777
{
78+
if (connection == null)
79+
{
80+
return Task.CompletedTask;
81+
}
82+
7883
return ((HttpConnection)connection).DisposeAsync();
7984
}
8085

src/Microsoft.Azure.SignalR/HubHost/ServiceHubDispatcher.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ public async Task<ConnectionContext> ConnectAsync(TransferFormat transferFormat,
110110

111111
public Task DisposeAsync(ConnectionContext connection)
112112
{
113+
if (connection == null)
114+
{
115+
return Task.CompletedTask;
116+
}
117+
113118
return ((HttpConnection)connection).DisposeAsync();
114119
}
115120

0 commit comments

Comments
 (0)