From da24c74c202a63a6681348d08ac0cc80cec8b19d Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Mon, 13 Sep 2021 23:51:01 +0300 Subject: [PATCH] player.h: fix `ForEachItem()` items iteration --- regamedll/dlls/player.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; } }