From 1c4d9be74faf24139c88a651d263cd4028ab7d7f Mon Sep 17 00:00:00 2001 From: Nico <122193236+Nico8340@users.noreply.github.com> Date: Sat, 14 Dec 2024 05:06:16 +0100 Subject: [PATCH] Check before sending to prevent crash Checks if the player exists and only then performs the next check which applies to the BitStream version --- .../deathmatch/logic/CStaticFunctionDefinitions.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 24c9ff6edc..4a1e5f6574 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -10862,14 +10862,16 @@ bool CStaticFunctionDefinitions::SendSyncIntervals(CPlayer* pPlayer) BitStream.pBitStream->Write(g_TickRateSettings.iKeySyncRotation); BitStream.pBitStream->Write(g_TickRateSettings.iKeySyncAnalogMove); - if (pPlayer->CanBitStream(eBitStreamVersion::FixSyncerDistance)) + if (pPlayer) { - BitStream.pBitStream->Write(g_TickRateSettings.iPedSyncerDistance); - BitStream.pBitStream->Write(g_TickRateSettings.iUnoccupiedVehicleSyncerDistance); - } + if (pPlayer->CanBitStream(eBitStreamVersion::FixSyncerDistance)) + { + BitStream.pBitStream->Write(g_TickRateSettings.iPedSyncerDistance); + BitStream.pBitStream->Write(g_TickRateSettings.iUnoccupiedVehicleSyncerDistance); + } - if (pPlayer) pPlayer->Send(CLuaPacket(SET_SYNC_INTERVALS, *BitStream.pBitStream)); + } else m_pPlayerManager->BroadcastOnlyJoined(CLuaPacket(SET_SYNC_INTERVALS, *BitStream.pBitStream));