fix: NetworkIdentity.SetClientOwner: overwriting the owner was still possible even though it shouldn't be. all caller functions double check and return early if it already has an owner, so we should do the same here.

This commit is contained in:
vis2k 2020-02-26 18:30:30 +01:00
parent 1a9625ee4a
commit 548db52fdf

View File

@ -206,10 +206,14 @@ internal set
// used when adding players
internal void SetClientOwner(NetworkConnection conn)
{
// do nothing if it already has an owner
if (connectionToClient != null && conn != connectionToClient)
{
Debug.LogError($"Object {this} netId={netId} already has an owner. Use RemoveClientAuthority() first", this);
return;
}
// otherwise set the owner connection
connectionToClient = (NetworkConnectionToClient)conn;
}