Fix ConsumableQueue.consume with no entries present.
This commit is contained in:
parent
0422ee495c
commit
e5078ad399
|
@ -70,6 +70,7 @@ final class ConsumableQueue(T)
|
||||||
*/
|
*/
|
||||||
ConsumedRange consume()
|
ConsumedRange consume()
|
||||||
@safe {
|
@safe {
|
||||||
|
if (!m_pendingCount) return ConsumedRange(null, 0, 0);
|
||||||
auto first = (m_first + m_consumedCount) % m_storage.length;
|
auto first = (m_first + m_consumedCount) % m_storage.length;
|
||||||
auto count = m_pendingCount;
|
auto count = m_pendingCount;
|
||||||
m_consumedCount += count;
|
m_consumedCount += count;
|
||||||
|
|
Loading…
Reference in a new issue