mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
Merge #3478
3478: Fix server crash with too many items (fixes #3477) r=heinrich5991 a=def- <!-- What is the motivation for the changes of this pull request --> ## 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: def <dennis@felsin9.de>
This commit is contained in:
commit
f68e7853be
|
@ -404,6 +404,8 @@ void CPlayer::Snap(int SnappingClient)
|
||||||
GameServer()->m_apPlayers[SnappingClient]->m_TimerType == TIMERTYPE_SIXUP)
|
GameServer()->m_apPlayers[SnappingClient]->m_TimerType == TIMERTYPE_SIXUP)
|
||||||
{
|
{
|
||||||
protocol7::CNetObj_PlayerInfoRace *pRaceInfo = static_cast<protocol7::CNetObj_PlayerInfoRace *>(Server()->SnapNewItem(-protocol7::NETOBJTYPE_PLAYERINFORACE, id, sizeof(protocol7::CNetObj_PlayerInfoRace)));
|
protocol7::CNetObj_PlayerInfoRace *pRaceInfo = static_cast<protocol7::CNetObj_PlayerInfoRace *>(Server()->SnapNewItem(-protocol7::NETOBJTYPE_PLAYERINFORACE, id, sizeof(protocol7::CNetObj_PlayerInfoRace)));
|
||||||
|
if(!pRaceInfo)
|
||||||
|
return;
|
||||||
pRaceInfo->m_RaceStartTick = m_pCharacter->m_StartTime;
|
pRaceInfo->m_RaceStartTick = m_pCharacter->m_StartTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,6 +420,9 @@ void CPlayer::Snap(int SnappingClient)
|
||||||
if(ShowSpec)
|
if(ShowSpec)
|
||||||
{
|
{
|
||||||
CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, id, sizeof(CNetObj_SpecChar)));
|
CNetObj_SpecChar *pSpecChar = static_cast<CNetObj_SpecChar *>(Server()->SnapNewItem(NETOBJTYPE_SPECCHAR, id, sizeof(CNetObj_SpecChar)));
|
||||||
|
if(!pSpecChar)
|
||||||
|
return;
|
||||||
|
|
||||||
pSpecChar->m_X = m_pCharacter->Core()->m_Pos.x;
|
pSpecChar->m_X = m_pCharacter->Core()->m_Pos.x;
|
||||||
pSpecChar->m_Y = m_pCharacter->Core()->m_Pos.y;
|
pSpecChar->m_Y = m_pCharacter->Core()->m_Pos.y;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue