NullRef in RPC() error handling when function name is wrong and there is no parameter (Pun 2.9)
Options
Hello,
I haven't updated to the newest Pun but there's nothing about this bug in the 2.11 and 2.12 changelog (haven't seen the 2.10 changelog as it's not on the asset store).
If I call PhotonView.RPC() with a function name that has a typo, and the RPC call has zero custom arguments, then I get this nullref:
NullReferenceException: Object reference not set to an instance of an object
Photon.Pun.PhotonNetwork.ExecuteRpc (ExitGames.Client.Photon.Hashtable rpcData, Photon.Realtime.Player sender) (at Assets/Tools/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:506)
In case the code in PhotonNetworkPart.cs has changed since 2.9, here are the offending lines:
I haven't updated to the newest Pun but there's nothing about this bug in the 2.11 and 2.12 changelog (haven't seen the 2.10 changelog as it's not on the asset store).
If I call PhotonView.RPC() with a function name that has a typo, and the RPC call has zero custom arguments, then I get this nullref:
NullReferenceException: Object reference not set to an instance of an object
Photon.Pun.PhotonNetwork.ExecuteRpc (ExitGames.Client.Photon.Hashtable rpcData, Photon.Realtime.Player sender) (at Assets/Tools/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:506)
In case the code in PhotonNetworkPart.cs has changed since 2.9, here are the offending lines:
// Error handling if (receivers != 1) { string argsString = string.Empty; for (int index = 0; index < argumentsTypes.Length; index++)(more specifically the last one)
0
Comments
-
It happens on 2.9. I haven't tried 2.10, 2.11 or 2.12.
To reproduce, just call GetComponent< PhotonView >().RPC("NonExistantFunction", RpcTarget.All).
0 -
The bug is still in PUN 2.13. NullRef in PhotonNetworkPart.cs line 508.0
-
Why do you need to call a non existing RPC method?
PUN RPCs expect the method with the same name to be there on the PhotonView.
So maybe what you see is the normal behaviour when it's not there.
What should be the expected behaviour according to you?0 -
I do not need to call a non existing RPC method. There is a bug in our code that triggers this code in PUN which is supposed to display an error message telling us which is the wrong RPC name we tried to call, but this error logging code is bugged so we only get a nullref and no useful error message.0
-
OK, we will investigate.
Thanks.0