mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #4091
4091: Check for null. Fix #4090 r=edg-l a=Learath2 <!-- What is the motivation for the changes of this pull request --> `@ChillerDragon` can you check if this fixes the issue? ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Learath <learath2@gmail.com>
This commit is contained in:
commit
551369cda1
|
@ -1246,10 +1246,12 @@ void CCharacter::Snap(int SnappingClient)
|
||||||
|
|
||||||
SnapCharacter(SnappingClient, ID);
|
SnapCharacter(SnappingClient, ID);
|
||||||
|
|
||||||
CNetObj_SwitchState *pSwitchState = static_cast<CNetObj_SwitchState *>(Server()->SnapNewItem(NETOBJTYPE_SWITCHSTATE, ID, sizeof(CNetObj_SwitchState)));
|
if(GameServer()->Collision()->m_pSwitchers)
|
||||||
|
|
||||||
if(pSwitchState)
|
|
||||||
{
|
{
|
||||||
|
CNetObj_SwitchState *pSwitchState = static_cast<CNetObj_SwitchState *>(Server()->SnapNewItem(NETOBJTYPE_SWITCHSTATE, ID, sizeof(CNetObj_SwitchState)));
|
||||||
|
if(!pSwitchState)
|
||||||
|
return;
|
||||||
|
|
||||||
pSwitchState->m_NumSwitchers = GameServer()->Collision()->m_NumSwitchers;
|
pSwitchState->m_NumSwitchers = GameServer()->Collision()->m_NumSwitchers;
|
||||||
|
|
||||||
if(pSwitchState->m_NumSwitchers > 256)
|
if(pSwitchState->m_NumSwitchers > 256)
|
||||||
|
|
Loading…
Reference in a new issue