Skip to content

Commit

Permalink
player.h: fix ForEachItem() items iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyShorokhov committed Sep 13, 2021
1 parent b49bf79 commit 37e7b12
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions reapi/include/cssdk/dlls/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,11 @@ class CBasePlayer: public CBaseMonster
auto item = m_rgpPlayerItems[ slot ];
while (item)
{
auto next = item->m_pNext;
if (func(static_cast<T *>(item)))
return static_cast<T *>(item);

item = item->m_pNext;
item = next;
}
return nullptr;
}
Expand All @@ -397,10 +398,11 @@ class CBasePlayer: public CBaseMonster
{
while (item)
{
auto next = item->m_pNext;
if (func(static_cast<T *>(item)))
return static_cast<T *>(item);

item = item->m_pNext;
item = next;
}
}
return nullptr;
Expand Down

0 comments on commit 37e7b12

Please sign in to comment.