Skip to content

Commit 875eaab

Browse files
committed
Fix queue potential bugs
1 parent be8c4f7 commit 875eaab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

queue.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,10 @@ func (q *LinkedListQueue[T]) Pop() (T, error) {
460460
if q.last == nil {
461461
q.first = nil
462462
}
463-
val := node.Val
463+
val := *node.Val
464464
q.recycleNode(node)
465465

466-
return *val, nil
466+
return val, nil
467467
}
468468

469469
// Push Push the data to the last position(non-blocking)

0 commit comments

Comments
 (0)