Skip to content

Commit f42ba1a

Browse files
committed
Added null checks on resolved RPC behaviours
1 parent 003377b commit f42ba1a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

MLAPI/NetworkingManagerComponents/Core/InternalMessageHandler.Receive.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,10 @@ internal static void HandleServerRPC(uint clientId, Stream stream, int channelId
346346
if (SpawnManager.SpawnedObjects.ContainsKey(networkId))
347347
{
348348
NetworkedBehaviour behaviour = SpawnManager.SpawnedObjects[networkId].GetBehaviourAtOrderIndex(behaviourId);
349-
behaviour.OnRemoteServerRPC(hash, clientId, stream);
349+
if (behaviour != null)
350+
{
351+
behaviour.OnRemoteServerRPC(hash, clientId, stream);
352+
}
350353
}
351354
}
352355
}
@@ -362,7 +365,10 @@ internal static void HandleClientRPC(uint clientId, Stream stream, int channelId
362365
if (SpawnManager.SpawnedObjects.ContainsKey(networkId))
363366
{
364367
NetworkedBehaviour behaviour = SpawnManager.SpawnedObjects[networkId].GetBehaviourAtOrderIndex(behaviourId);
365-
behaviour.OnRemoteClientRPC(hash, clientId, stream);
368+
if (behaviour != null)
369+
{
370+
behaviour.OnRemoteClientRPC(hash, clientId, stream);
371+
}
366372
}
367373
}
368374
}

0 commit comments

Comments
 (0)