Make a safe-check for HandleUpdatePlayer and HandleSyncPckt

This commit is contained in:
Sofia 2020-08-08 08:38:37 +03:00
parent 72aa771a83
commit becb920129

View File

@ -131,14 +131,14 @@ namespace NeonTea.Quakeball.Networking.Instances {
}
private void HandleUpdatePlayer(PlayerUpdatePckt pckt) {
if (pckt.PlayerId == LocalPlayer.Id) {
if (pckt.PlayerId == LocalPlayer.Id && Players[pckt.PlayerId] != null) {
return; // Ignore, again.
}
Players[pckt.PlayerId].Controlled.ProcessUpdatePacket(pckt);
}
private void HandleSyncPckt(PlayerSyncPacket syncPckt) {
if (syncPckt.Unsynced || syncPckt.PlayerId != LocalPlayer.Id) {
if (Players[syncPckt.PlayerId] != null && (syncPckt.Unsynced || syncPckt.PlayerId != LocalPlayer.Id)) {
Players[syncPckt.PlayerId].Controlled.ProcessSyncPacket(syncPckt);
}
}