Skip to content

Commit

Permalink
Fix potential NullReferenceException during cancellation. Fixes #1472
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrainger committed Apr 22, 2024
1 parent 320a007 commit 0a8feb1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/MySqlConnector/Core/ServerSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ private async Task<bool> OpenTcpSocketAsync(ConnectionSettings cs, ILoadBalancer
{
tcpClient = new(ipAddress.AddressFamily);

using (cancellationToken.Register(() => tcpClient.Client?.Dispose()))
using (cancellationToken.Register(() => tcpClient?.Client?.Dispose()))
{
try
{
Expand Down

0 comments on commit 0a8feb1

Please sign in to comment.