Skip to content

Commit 1081301

Browse files
committed
UTIL_ResetEntities: Crash fixed, sometimes returns NULL for 1 index
1 parent 21dab90 commit 1081301

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

regamedll/dlls/util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,10 +1502,10 @@ void UTIL_RestartOther(const char *szClassname)
15021502

15031503
void UTIL_ResetEntities()
15041504
{
1505-
edict_t *pEdict = INDEXENT(1);
1506-
for (int i = 1; i < gpGlobals->maxEntities; i++, pEdict++)
1505+
for (int i = 1; i < gpGlobals->maxEntities; i++)
15071506
{
1508-
if (pEdict->free)
1507+
edict_t *pEdict = INDEXENT(i);
1508+
if (!pEdict || pEdict->free)
15091509
continue;
15101510

15111511
CBaseEntity *pEntity = CBaseEntity::Instance(pEdict);

0 commit comments

Comments
 (0)