Skip to content

Commit 6901537

Browse files
committed
fix(client): ObjectDisposedException for udp client
1 parent 8d7c69c commit 6901537

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Pulse.Unity/Assets/Scripts/Pulse/Runtime/Transports/UdpTransport.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ public UdpTransport(string host, int port, int sendBufferSize, int receiveBuffer
1717

1818
public int SendData(byte[] data)
1919
{
20-
var i= _udpClient.Send(data, data.Length);
21-
return i;
20+
var i= _udpClient?.Send(data, data.Length);
21+
return i ?? 0;
2222
}
2323

2424
public async void SendDataAsync(byte[] data)
2525
{
26-
await _udpClient.SendAsync(data, data.Length);
26+
await _udpClient?.SendAsync(data, data.Length)!;
2727
}
2828

2929
public void Dispose()

0 commit comments

Comments
 (0)