Skip to content

Commit

Permalink
Hack queue to return the last element when empty. Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
gberche-orange committed Oct 29, 2024
1 parent d34092a commit d4e3a08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (q *Queue[T]) Pop() (*T, bool) {
defer q.lock.Unlock()

val := q.slice[0]
if len(q.slice) != 0 {
if len(q.slice) > 1 {
q.slice = q.slice[1:]
q.Size--
}
Expand Down

0 comments on commit d4e3a08

Please sign in to comment.