Skip to content

Commit 5f2083f

Browse files
authored
Merge pull request #1224 from yileicn/master
hotfix HttpContext NullReferenceException
2 parents 1716ec0 + 078d685 commit 5f2083f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Plugins/BotSharp.Plugin.ChatHub/SignalRHub.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public override async Task OnConnectedAsync()
2828
_logger.LogInformation($"SignalR Hub: {_user.FirstName} {_user.LastName} ({Context.User.Identity.Name}) connected in {Context.ConnectionId}");
2929

3030
var convService = _services.GetRequiredService<IConversationService>();
31-
_context.HttpContext.Request.Query.TryGetValue("conversation-id", out var conversationId);
31+
var httpContext = Context.GetHttpContext();
32+
string? conversationId = httpContext?.Request?.Query["conversation-id"].FirstOrDefault();
3233

3334
if (!string.IsNullOrEmpty(conversationId))
3435
{

0 commit comments

Comments
 (0)