player.h: fix ForEachItem() items iteration

This commit is contained in:
Sergey Shorokhov 2021-09-13 23:51:01 +03:00
parent 667242fadd
commit da24c74c20

View File

@ -650,10 +650,11 @@ public:
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;
@ -666,10 +667,11 @@ public:
{
while (item)
{
auto next = item->m_pNext;
if (func(static_cast<T *>(item)))
return static_cast<T *>(item);
item = item->m_pNext;
item = next;
}
}