From a9c11d07b3103a30862ddbb7b81607bdfd656467 Mon Sep 17 00:00:00 2001 From: Learath Date: Mon, 16 Aug 2021 19:11:43 +0300 Subject: [PATCH] Check for null. Fix #4090 --- src/game/server/entities/character.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index ae09efaff..08e1c0992 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -1246,10 +1246,12 @@ void CCharacter::Snap(int SnappingClient) SnapCharacter(SnappingClient, ID); - CNetObj_SwitchState *pSwitchState = static_cast(Server()->SnapNewItem(NETOBJTYPE_SWITCHSTATE, ID, sizeof(CNetObj_SwitchState))); - - if(pSwitchState) + if(GameServer()->Collision()->m_pSwitchers) { + CNetObj_SwitchState *pSwitchState = static_cast(Server()->SnapNewItem(NETOBJTYPE_SWITCHSTATE, ID, sizeof(CNetObj_SwitchState))); + if(!pSwitchState) + return; + pSwitchState->m_NumSwitchers = GameServer()->Collision()->m_NumSwitchers; if(pSwitchState->m_NumSwitchers > 256)