Fix heap-use-after-free when quitting/restarting

Items and particles were also rendered in the client states quitting and restarting, which was causing accesses to the already freed map data.
This commit is contained in:
Robert Müller 2023-05-14 17:44:29 +02:00
parent 03d17a98ed
commit f3e8513477
2 changed files with 2 additions and 2 deletions

View file

@ -358,7 +358,7 @@ void CItems::RenderLaser(const CLaserData *pCurrent, bool IsPredicted)
void CItems::OnRender() void CItems::OnRender()
{ {
if(Client()->State() < IClient::STATE_ONLINE) if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return; return;
bool IsSuper = m_pClient->IsLocalCharSuper(); bool IsSuper = m_pClient->IsLocalCharSuper();

View file

@ -145,7 +145,7 @@ void CParticles::Update(float TimePassed)
void CParticles::OnRender() void CParticles::OnRender()
{ {
if(Client()->State() < IClient::STATE_ONLINE) if(Client()->State() != IClient::STATE_ONLINE && Client()->State() != IClient::STATE_DEMOPLAYBACK)
return; return;
set_new_tick(); set_new_tick();