diff --git a/core/container/queue.odin b/core/container/queue.odin index 6e7e79ad3..2664b9a08 100644 --- a/core/container/queue.odin +++ b/core/container/queue.odin @@ -115,6 +115,9 @@ queue_pop_front :: proc(q: ^$Q/Queue($T)) -> T { item := queue_get(q^, 0); q.offset = (q.offset + 1) % array_len(q.data); q.len -= 1; + if q.len == 0 { + q.offset = 0; + } return item; }