Skip to content

Commit

Permalink
fix(ServerRpc): fixing error message when client is not set
Browse files Browse the repository at this point in the history
if behaviour isn't spawned it wont have a Client so will give null reference exception
  • Loading branch information
James-Frowen committed Sep 30, 2021
1 parent d1d514b commit f9c8033
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Assets/Mirage/Runtime/NetworkBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private void ValidateServerRpc(Type invokeClass, string cmdName, bool requireAut
// this was in Weaver before
// NOTE: we could remove this later to allow calling Cmds on Server
// to avoid Wrapper functions. a lot of people requested this.
if (!Client.Active)
if (Client == null || !Client.Active)
{
throw new InvalidOperationException($"ServerRpc Function {cmdName} called on server without an active client.");
}
Expand Down

0 comments on commit f9c8033

Please sign in to comment.