diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index adebe12a..e62c1b73 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -650,10 +650,11 @@ public: auto item = m_rgpPlayerItems[slot]; while (item) { + auto next = item->m_pNext; if (func(static_cast(item))) return static_cast(item); - item = item->m_pNext; + item = next; } return nullptr; @@ -666,10 +667,11 @@ public: { while (item) { + auto next = item->m_pNext; if (func(static_cast(item))) return static_cast(item); - item = item->m_pNext; + item = next; } }