Fix infinite loop

This commit is contained in:
Jérôme Leclercq 2020-08-25 12:34:43 +02:00
parent fa6d026edc
commit 982d28cace
2 changed files with 10 additions and 6 deletions

View File

@ -27,10 +27,12 @@ namespace Nz
std::size_t poolCount = m_descriptorPools.size();
if (poolCount >= 2 && m_descriptorPools.back().freeBindings.TestAll())
{
for (std::size_t i = poolCount - 1; i > 0; ++i)
for (std::size_t i = poolCount - 1; i > 0; --i)
{
if (m_descriptorPools[i].freeBindings.TestAll())
poolCount--;
if (!m_descriptorPools[i].freeBindings.TestAll())
break;
poolCount--;
}
m_descriptorPools.resize(poolCount);

View File

@ -27,10 +27,12 @@ namespace Nz
std::size_t poolCount = m_descriptorPools.size();
if (poolCount >= 2 && m_descriptorPools.back().freeBindings.TestAll())
{
for (std::size_t i = poolCount - 1; i > 0; ++i)
for (std::size_t i = poolCount - 1; i > 0; --i)
{
if (m_descriptorPools[i].freeBindings.TestAll())
poolCount--;
if (!m_descriptorPools[i].freeBindings.TestAll())
break;
poolCount--;
}
m_descriptorPools.resize(poolCount);