Don't access switchers out of bounds (fixes #4386)

It's possible that a map was saved with a different amount of switchers
than it has at the moment. Happened on Jao Shooter. I'll check with
mapper if they changed the number of switchers.
This commit is contained in:
def 2021-11-23 18:48:07 +01:00
parent c18d4f8254
commit 2e34f45c50

View file

@ -528,7 +528,7 @@ void CSaveTeam::Load(int Team, bool KeepCurrentWeakStrong)
if(m_pController->GameServer()->Collision()->m_NumSwitchers)
{
for(int i = 1; i < m_pController->GameServer()->Collision()->m_NumSwitchers + 1; i++)
for(int i = 1; i < minimum(m_NumSwitchers, m_pController->GameServer()->Collision()->m_NumSwitchers) + 1; i++)
{
m_pController->GameServer()->Collision()->m_pSwitchers[i].m_Status[Team] = m_pSwitchers[i].m_Status;
if(m_pSwitchers[i].m_EndTime)