Fix out-of-bounds error in ConsumableQueue.

This commit is contained in:
Sönke Ludwig 2016-06-15 22:16:49 +02:00
parent f808f89e7c
commit 80df8e1ce8

View file

@ -56,8 +56,10 @@ class ConsumableQueue(T)
{ {
foreach (i; 0 .. m_pendingCount) foreach (i; 0 .. m_pendingCount)
if (getPendingAt(i) == item) { if (getPendingAt(i) == item) {
if (m_pendingCount > 1)
getPendingAt(i) = getPendingAt(m_pendingCount-1); getPendingAt(i) = getPendingAt(m_pendingCount-1);
m_pendingCount--; m_pendingCount--;
break;
} }
} }