Fix crash when enabling dbg_dummies on running server

The server normally needs to be reloaded to spawn the debug dummies, so this code was not checking if a debug dummy player exists. Decreasing the number of debug dummies while the server is running also causes them to simply not be snapped instead of completely destroying them.
This commit is contained in:
Robert Müller 2023-06-05 22:30:52 +02:00
parent a5f94ecf80
commit 4c80af7bd9

View file

@ -1204,9 +1204,12 @@ void CGameContext::OnTick()
{
for(int i = 0; i < g_Config.m_DbgDummies; i++)
{
CNetObj_PlayerInput Input = {0};
Input.m_Direction = (i & 1) ? -1 : 1;
m_apPlayers[MAX_CLIENTS - i - 1]->OnPredictedInput(&Input);
if(m_apPlayers[MAX_CLIENTS - i - 1])
{
CNetObj_PlayerInput Input = {0};
Input.m_Direction = (i & 1) ? -1 : 1;
m_apPlayers[MAX_CLIENTS - i - 1]->OnPredictedInput(&Input);
}
}
}
#endif