fix: #3708 Kcp Stophost() null reference exception

This commit is contained in:
mischa 2024-01-01 09:40:39 +01:00
parent 4285a9b123
commit 56a1aa096f

View File

@ -116,7 +116,7 @@ protected virtual void Awake()
client = new KcpClient( client = new KcpClient(
() => OnClientConnected.Invoke(), () => OnClientConnected.Invoke(),
(message, channel) => OnClientDataReceived.Invoke(message, FromKcpChannel(channel)), (message, channel) => OnClientDataReceived.Invoke(message, FromKcpChannel(channel)),
() => OnClientDisconnected.Invoke(), () => OnClientDisconnected?.Invoke(), // may be null in StopHost(): https://github.com/MirrorNetworking/Mirror/issues/3708
(error, reason) => OnClientError.Invoke(ToTransportError(error), reason), (error, reason) => OnClientError.Invoke(ToTransportError(error), reason),
config config
); );