Skip to content

Commit

Permalink
UTIL_ResetEntities: Crash fixed, sometimes returns NULL for 1 index
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Jun 14, 2022
1 parent 21dab90 commit 1081301
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions regamedll/dlls/util.cpp
Expand Up @@ -1502,10 +1502,10 @@ void UTIL_RestartOther(const char *szClassname)

void UTIL_ResetEntities()
{
edict_t *pEdict = INDEXENT(1);
for (int i = 1; i < gpGlobals->maxEntities; i++, pEdict++)
for (int i = 1; i < gpGlobals->maxEntities; i++)
{
if (pEdict->free)
edict_t *pEdict = INDEXENT(i);
if (!pEdict || pEdict->free)
continue;

CBaseEntity *pEntity = CBaseEntity::Instance(pEdict);
Expand Down

0 comments on commit 1081301

Please sign in to comment.