Skip to content

Commit 0a8feb1

Browse files
committed
Fix potential NullReferenceException during cancellation. Fixes #1472
1 parent 320a007 commit 0a8feb1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MySqlConnector/Core/ServerSession.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ private async Task<bool> OpenTcpSocketAsync(ConnectionSettings cs, ILoadBalancer
10251025
{
10261026
tcpClient = new(ipAddress.AddressFamily);
10271027

1028-
using (cancellationToken.Register(() => tcpClient.Client?.Dispose()))
1028+
using (cancellationToken.Register(() => tcpClient?.Client?.Dispose()))
10291029
{
10301030
try
10311031
{

0 commit comments

Comments
 (0)