From 80df8e1ce857e5f705988d71d2fa08118566a7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Wed, 15 Jun 2016 22:16:49 +0200 Subject: [PATCH] Fix out-of-bounds error in ConsumableQueue. --- source/eventcore/internal/consumablequeue.d | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/eventcore/internal/consumablequeue.d b/source/eventcore/internal/consumablequeue.d index 6cf06fc..df3caea 100644 --- a/source/eventcore/internal/consumablequeue.d +++ b/source/eventcore/internal/consumablequeue.d @@ -56,8 +56,10 @@ class ConsumableQueue(T) { foreach (i; 0 .. m_pendingCount) if (getPendingAt(i) == item) { - getPendingAt(i) = getPendingAt(m_pendingCount-1); + if (m_pendingCount > 1) + getPendingAt(i) = getPendingAt(m_pendingCount-1); m_pendingCount--; + break; } }