From 37e7b12ba0b6a23fb30db7148e276afd808b6a10 Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Mon, 13 Sep 2021 23:47:59 +0300 Subject: [PATCH] player.h: fix `ForEachItem()` items iteration --- reapi/include/cssdk/dlls/player.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reapi/include/cssdk/dlls/player.h b/reapi/include/cssdk/dlls/player.h index 4f396b7..b267251 100644 --- a/reapi/include/cssdk/dlls/player.h +++ b/reapi/include/cssdk/dlls/player.h @@ -383,10 +383,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; } @@ -397,10 +398,11 @@ public: { while (item) { + auto next = item->m_pNext; if (func(static_cast(item))) return static_cast(item); - item = item->m_pNext; + item = next; } } return nullptr;